如何在单独的控制台上使用一种配置启动多个 Java 程序(使用 Eclipse)
我正在使用一个具有多个组件的 Java 程序(目前使用 Eclipse 和 Ant)。
有没有一种方法可以通过一个启动配置启动多个程序? 我有一个 Ant 目标可以完成这项工作(启动多个程序),但我想做一些事情:
- 我想使用 Eclipse 调试程序,因此需要启动 Eclipse。
- 我想在不同的控制台上查看程序的输出。
另外,使用单独的控制台和/或调试“一键式”启动多个 Java 程序的其他方法也可以。
I'm working with a Java program that has multiple components (with Eclipse & Ant at the moment).
Is there some way to start multiple programs with one launch configuration? I have an Ant target that does the job (launches multiple programs) but there are things I would like to do:
- I would like to debug the programs with Eclipse, hence the need for Eclipse launch.
- I would like to see the outputs for the programs at separate consoles.
Also other ways to launch multiple Java programs "with one click" with separate consoles and/or debugging would be ok.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
['multiple launch part':]
如果您有一个 ant 启动配置,可以执行您想要的操作,您可以随时将其转换为调用 ant 的 java 启动器。
然后,您可以将这个 ant 会话作为常规 Java 应用程序启动,并使用所有 Eclipse 调试工具。
添加到“用户条目”部分中的类路径(在您的项目和默认路径之前):
[多个控制台部分]
可能的解决方案可能是确保您的 ant启动器实际上在自己的 JVM 进程中启动不同的应用程序(每个应用程序一个 javaw.exe),
这样,您就可以使用 本机 Eclipse 控制台在不同进程之间切换。
['multiple launch part':]
If you have an ant launch configuration which does what you want, you can always transform it into a java launcher calling ant.
You can then launch this ant session as a regular java application, with all eclipse debugging facilities at your disposal.
Add to your classpath in the User Entries section (before your project and default path):
[Multiple console part]
May be a possible solution would be to make sure your ant launcher actually launches the different application in their own JVM process (one javaw.exe for each application)
That way, you could use the ability of the native eclipse console to switch between different process.
这里的问题和所选答案都是 6 年前的。
Eclipse 启动组< /a> 提供 UI 来运行多个启动配置。 启动组显然是 CDT 的一部分,但可以通过安装“C/C++ 远程启动”(org.eclipse.cdt.launch.remote)单独安装,无需 CDT )。
The question and selected answer here are both 6 years old.
Eclipse Launch Groups provides UI to run multiple launch configs. Launch Groups is apparently part of CDT but can be installed separately without CDT by installing "C/C++ Remote Launch" (org.eclipse.cdt.launch.remote).
实际上,在 Eclipse 站点上打开了一张请求此完全相同功能的票证。 其中一位贡献者提出了一个插件,它允许对更多启动配置(可能是不同类型的)进行分组,并通过单击鼠标启动所有配置。
虽然插件功能有限,但效果很好。 包含源代码,因此您可以根据需要进行更改。 您必须在 Eclipse 中将其作为 PDE 项目打开,并将其导出为 JAR,然后将该 JAR 文件放入 Eclipse 的插件文件夹中。 有点麻烦,但你只需要执行一次。 之后重新启动 Eclipse 并在启动配置对话框中查找“Basic Workflow”。
插件源代码可在此处获取: https://bugs.eclipse.org/bugs /show_bug.cgi?id=39900#attach_177951
There's actually a ticket opened at Eclipse site which requests this very same functionality. One of the contributors there proposed a plugin which allows grouping more launch configurations (possibly of different types) and start all of them with one mouse click.
Although the plugin functionality is limited, it does a great job. Source code is included so you can make changes as necessary. You will have to open it as a PDE project in your Eclipse and export it as a JAR, then place the JAR file in your Eclipse' plugins folder. A bit cumbersome but you do this only one time. After that restart your Eclipse and look for "Basic Workflow" in your launch configurations dialog.
Plugin source is available here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=39900#attach_177951