简体   繁体   English

一次从Eclipse运行两个Java程序?

[英]Run two Java programs from Eclipse at once?

I am building a Java Google App Engine server project and a Java desktop client. 我正在构建一个Java Google App Engine服务器项目和一个Java桌面客户端。 I would like to run them both at once, but I'm not sure if this is possible using Eclipse/GAE plugin. 我想同时运行它们,但我不确定使用Eclipse / GAE插件是否可行。 Is there some way? 有什么办法吗? I'd like to be able to step through them both at the same time. 我希望能够同时介绍它们。

I tried opening a new instance of Eclipse, but it complained that the workspace is already in use, both projects are in the same workspace. 我尝试打开一个新的Eclipse实例,但它抱怨工作区已经在使用,两个项目都在同一个工作区。 (Perhaps I could just move them to different workspaces.) (也许我可以将它们移动到不同的工作区。)

I'm not familiar with the GAE and if that interferes, but I don't have a problem running multiples. 我不熟悉GAE,如果干扰,我运行倍数没有问题。 I often fire up a server and multiple clients from the same window. 我经常从同一个窗口启动服务器和多个客户端。

A few pointers: 几点建议:

  • Go to the main method of each program to run them. 转到每个程序的main方法来运行它们。 Once you've run them once, they show up in the drop menu on the run button. 一旦运行它们,它们就会显示在运行按钮的下拉菜单中。
  • Make multiple consoles and pin them. 制作多个控制台并固定它们。 It makes it much easier to see your (debug/informational) outputs in real time. 它使您可以更加轻松地实时查看(调试/信息)输出。
  • Move the multiple consoles to separate views so you can see them at the same time. 将多个控制台移动到单独的视图,以便您可以同时查看它们。

Before on top, after on bottom 在顶部之前,在底部之后 在此输入图像描述

After adding the new Console view, you must go to the icon to its left and select which console you want to see. 添加新的控制台视图后,您必须转到其左侧的图标,然后选择要查看的控制台。 If you're running two programs you will see the two programs in the drop down list. 如果您正在运行两个程序,您将在下拉列表中看到这两个程序。

Thanks for the answers. 谢谢你的回答。 I was just trying it out and it was really helpful. 我只是尝试一下,这真的很有帮助。

(By icon to the left I mean the one that looks like a mini purple color monitor) (左边的图标我的意思是看起来像迷你紫色显示器的那个)

@Corsika answer explains how to run on Eclipse @Corsika回答解释了如何在Eclipse上运行

If you are comfortable running on two or more programs on the terminal you can copy command line args from the debug view for different launch configurations and run on two or more terminals!! 如果您习惯在终端上运行两个或更多程序,则可以从调试视图中复制命令行参数以用于不同的启动配置,并在两个或更多终端上运行!

To get the full command line, you can open the Debug view from Window>Show View>Other>debug 要获取完整的命令行,可以从Window> Show View> Other> debug打开Debug视图

Now after run> Right click on the last launch(debug tab) and go to properties. 现在运行>右键单击上次启动(调试选项卡)并转到属性。 Eclipse will list the exact command line. Eclipse将列出确切的命令行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM