如何在eclipse中配置Java -D标志 [英] How to Configure Java -D flag in eclipse
问题描述
例如:
java -Dcom.siebel.management.jmxapi.cfgFileName=C:\monitor\1srvr.xml Component
其中(在Eclipse中)我使用名称和值配置-D标志。
组件
是一个类文件。
Where (in Eclipse) do I configure the -D flag with the name and the value.
Component
is a class file.
当我在eclipse中运行我的代码时,我得到下一个例外:
When I run my code in eclipse, i get the next exception:
SEVERE: Configuration file name must be specified in com.siebel.management.jmxapi.cfgFileName system property
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.siebel.management.jmxapi.JmxComponent.getState(JmxComponent.java:169)
at Component.main(Component.java:21)
Caused by: java.lang.IllegalArgumentException: Configuration file name must be specified in com.siebel.management.jmxapi.cfgFileName system property
at com.siebel.management.jmxapi.SiebelAgentUtil.<init>(SiebelAgentUtil.java:78)
at com.siebel.management.jmxapi.SiebelAgentUtil.<clinit>(SiebelAgentUtil.java:43)
... 2 more
推荐答案
有几种方法可以在Eclipse中执行此操作。
There are a couple of easy ways to do this in Eclipse.
1)从顶部的栏选择运行 - >运行配置
1) From the very top bar select Run->Run Configurations
或
2)右键单击您的项目并选择运行As->运行配置
2) Right click your project and select Run As->Run Configurations
接下来,常见的步骤是在左窗格中选择您的项目类(包含main方法)并在右侧的相应的相邻窗格中选择参数
Next, the common step is to select your project class(those that contain main method) in the left pane and in the corresponding neighboring pane on the right choose Arguments
设置所需的参数(程序或VM参数)
这篇关于如何在eclipse中配置Java -D标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!