Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在eclipse中设置启动配置的属性_Eclipse_Configuration_Attributes_Launch - Fatal编程技术网

在eclipse中设置启动配置的属性

在eclipse中设置启动配置的属性,eclipse,configuration,attributes,launch,Eclipse,Configuration,Attributes,Launch,作为eclispe3.7中的一个应用程序,我想在每次启动时为启动配置设置一个属性。Iam使用以下命令设置属性,但在获取属性时,它仅显示默认属性值 launch.getLaunchConfiguration().getWorkingCopy().setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value); 在另一个类上,使用以下代码从第一个类启动: launch.getLaunchConfiguration()..getWork

作为eclispe3.7中的一个应用程序,我想在每次启动时为启动配置设置一个属性。Iam使用以下命令设置属性,但在获取属性时,它仅显示默认属性值

launch.getLaunchConfiguration().getWorkingCopy().setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value);
在另一个类上,使用以下代码从第一个类启动:

launch.getLaunchConfiguration()..getWorkingCopy().getAttributes();

为什么不能设置属性?请帮助我…

我怀疑问题在于每次调用getWorkingCopy()都会得到不同的工作副本。如果在调试器中检查工作副本对象的Java ID,则可以确定

希望这有帮助,
Thomas

当您使用getWorkingCopy()时,您将获得原始状态的副本,但除此之外还需要使用doSave()

你可以在这里阅读,它是如何工作的:

ILaunchConfigurationWorkingCopy launchCopy = launch.getWorkingCopy();
launchCopy.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, value);
launch = launchCopy.doSave();