java - Eclipse:如何以编程方式执行启动配置?

标签 java eclipse eclipse-plugin

我的 Eclipse 项目中有各种启动配置文件。有什么方法可以以编程方式执行任意启动配置吗?

最佳答案

       ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();

       ILaunchConfigurationType type =     manager.getLaunchConfigurationType("org.eclipse.cdt.launch.applicationLaunchType");
       ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);

            for (ILaunchConfiguration iLaunchConfiguration : lcs) {
                if (iLaunchConfiguration.getName().equals("Test PThread")) {
                    ILaunchConfigurationWorkingCopy t = iLaunchConfiguration.getWorkingCopy();
                    ILaunchConfiguration config = t.doSave();
                    if (config != null) {
                        // config.launch(ILaunchManager.RUN_MODE, null);
                        DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
                    }
                }
            }

关于java - Eclipse:如何以编程方式执行启动配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10104238/

相关文章:

Eclipse Maven : no "Checkout Maven project from SCM" option

java - 在 eclipse 中向 java 编辑器添加自定义标记

java - 在 Grails Spring Data 应用程序中混合 java 和 groovy 代码时出错

eclipse - 从另一台计算机访问在 Eclipse 中运行的 Tomcat 8?

java - Eclipse执行jar中的文件

eclipse - 在“打开资源”窗口中使用热键选择事件工作集

Sencha Touch 集成开发环境

java - Xamarin Android - 启动画面在恢复时不起作用

java - 为什么我无法将 geotools RasterToVectorFactory 导入到我的项目中?

java - 将 JSP 中的值添加到 MySQL 中的另一个表