Java 一次运行多个启动配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4053265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 11:02:13  来源:igfitidea点击:

Running multiple launch configurations at once

javaeclipserun-configuration

提问by clamp

I have several launch configurations in Eclipse each launching the same Java program but with different parameters.

我在 Eclipse 中有几个启动配置,每个配置都启动相同的 Java 程序,但参数不同。

Now is it possible to run all of these at once (with one mouse click) instead of selecting each of it separately and launching it?

现在是否可以一次运行所有这些(单击鼠标),而不是分别选择每个并启动它?

采纳答案by anirvan

I found this post on the Eclipse trackers: Start multiple debug configurations at once

我在 Eclipse 跟踪器上找到了这篇文章:一次启动多个调试配置

While it talks about multi-launching debug configurations, I think it is just as applicable to run configurations.

虽然它谈到了多次启动调试配置,但我认为它同样适用于运行配置。

Launch Group

启动组

You may want to right click a run configuration in group launch and configure it.

您可能希望在组启动中右键单击运行配置并对其进行配置。

Launch sequential

启动顺序

回答by dpatchery

You can create a separate class that calls your program with different arguments, and run it instead.

您可以创建一个单独的类,用不同的参数调用您的程序,然后运行它。

public class YourClass {
    public static void main(String arg){
        System.out.println(arg);
    }
}

public class YourClassTester {
    public static void main(String[] args){
        YourClass.main("SomeArg1");
        YourClass.main("SomeArg2");
        YourClass.main("SomeArg3");
    }
}

回答by Andi

Just install "C/C++ Development Tools" from the CDT (see eclipse.org/cdt/downloads.php ) - this single package is enough, no other CDT packages are needed. This won't disturb your Java environment ;-) Then you have "Launch Groups", for any kind of project, including Java projects. See the following screenshot:

只需从 CDT 安装“C/C++ 开发工具”(请参阅​​ eclipse.org/cdt/downloads.php )——这个包就足够了,不需要其他 CDT 包。这不会干扰您的 Java 环境 ;-) 然后您就有了“启动组”,适用于任何类型的项目,包括 Java 项目。请参阅以下屏幕截图:

enter image description here

在此处输入图片说明

You can run or debug the projects (also mixed mode), define delay times and so on. Have fun!

您可以运行或调试项目(也可以是混合模式)、定义延迟时间等。玩得开心!

回答by Ryan

You don't need any plugin:

你不需要任何插件:

  1. Create all Run Configurations in eclipse
  2. Select Organize Favorites...
  3. Add you favorites, done
  1. 在 Eclipse 中创建所有运行配置
  2. 选择整理收藏夹...
  3. 添加您的收藏夹,完成

Screenshot

截屏

回答by studgeek

There are two more options listed in Launch an Eclipse Run Configuration from ANT.

从 ANT 启动 Eclipse 运行配置中列出了另外两个选项。

You could group them in Ant and then call them using Ant4Eclipse. Or call multiple launch configs from a command script using eclipse remote control.

您可以在 Ant中将它们分组,然后使用Ant4Eclipse调用它们。或者使用eclipse 远程控制从命令脚本调用多个启动配置。

回答by howlger

Since Eclipse Oxygen (4.7.0)you can use a run configuration of the type Launch Groupfor that.

从 Eclipse Oxygen (4.7.0) 开始,您可以为此使用Launch Group类型的运行配置。

This short video shows how to use a Launch Group.

这个简短的视频展示了如何使用启动组