且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在单独的控制台上使用一个配置启动多个Java程序(使用Eclipse)

更新时间:2022-11-07 12:59:28

['multiple launch part':]



如果你有一个蚂蚁启动配置,你想要的,你可以随时变换它成为一个java启动器调用ant。

 主类:org.apache.tools.ant.Main 

-Dant.home = $ {resource_loc:/ myPath / apache_ant}
-f $ {resource_loc:/myProject/config/myFile-ant.xml}

然后,您可以将此ant会话作为常规Java应用程序启动,所有eclipse调试工具



在用户条目部分( 您的项目和默认路径)之前添加到您的类路径中:




  • ant.jar

  • ant-launcher.jar






[多个控制台部分]



可能的解决方案是确保您的蚂蚁启动器实际上在自己的JVM进程中启动了不同的应用程序(每个应用程序都有一个javaw.exe)



这样,您可以使用本机eclipse控制台在不同进程之间切换


控制台视图清楚地分离每个不同进程的输出,并将它们保留在几个缓冲区中。控制台具有内置的开关功能,将自动切换视图以显示执行输出的最后一个进程的缓冲区,但是您可以轻松地将显示切换到要查看的任何进程缓冲区。 p>

要切换控制台缓冲区显示,只需点击控制台视图标题栏右侧第四个工具栏按钮旁边的黑色向下箭头(按钮
类似于计算机屏幕):

这将显示一个列出所有活动进程缓冲区的名称的弹出菜单,前面加上订单号。
当前显示的一个在订单号之前将有一个复选标记。您可以通过点击其名称将视图切换到另一个显示缓冲区。



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.

['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.

Main Class: org.apache.tools.ant.Main

-Dant.home=${resource_loc:/myPath/apache_ant} 
-f ${resource_loc:/myProject/config/myFile-ant.xml}

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):

  • ant.jar
  • ant-launcher.jar

[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.

The Console view clearly separates output from each distinct "process" and keeps them in several "buffers". The Console has a built-in "switch" feature that will automatically switch the view to display the buffer of the last process that performed output, however you can easily switch the display to any "process buffer" you want to look at.

To switch the Console "buffer" display, just click on the black "Down arrow" next to the 4th toolbar button from the right in the Console View's title bar (the button that resembles a computer screen):
this will show a pop-down menu listing the "names" of all active process buffers, preceded by an "order number". The one currently displayed will have a check-mark before its "order number". You can switch the view to another display buffer simply by clicking on its name.