设置 RCP 程序的系统属性
我有一个 RCP/Eclipse 程序,我想以 2 种不同的方式提供它。它的风格应该是硬编码的或作为无法在运行时更改的conf设置提供。
我首先想到的是在我的插件中复制一个特定的类,并将第二种风格的逻辑编码到该类中,并以某种方式将其打包为第二个 RCP 程序。然后我想我可以在同一个插件的一个类中简单地编写两种不同风格的代码,并通过系统属性区分是执行逻辑 1 还是逻辑 2。然后,我可以简单地复制 RCP 包,并在 launcher.ini 中提供一个带有附加参数的包,而另一个则不带该参数。
问题是我无法在 RCP 程序中设置简单的 Java 系统属性。我尝试过 launcher.exe -Dpropname=propvalue,我尝试将其添加到 launcher.ini,我已经在网上来回搜索了。网络上有很多文档解释了您可以作为系统属性或作为 launcher.ini 的属性提供的所有各种配置设置,但没有一个文档解释如何设置自定义属性。
有人有想法吗?
非常感谢, 凯
I have an RCP/Eclipse program and I want to provide it in 2 different flavors. Which flavor it is should be sort of hardcoded or provided as a conf setting that cannot be changed at runtime.
I was first thinking of having one specific class in my plugin duplicated and code the logic of the second flavor into that class and package it somehow as a second RCP program. Then I thought I can simple code the 2 different flavors in one class in the same plugin and differentiate by system property whether logic 1 or logic 2 is executed. Then I could've simply duplicated the RCP package and deliver one with an additional parameter in launcher.ini and the other without that parameter.
Problem is that I can't get a simple Java System Property set in an RCP program. I have tried launcher.exe -Dpropname=propvalue, I have tried adding it to launcher.ini, I have googled the web back and forth. There are lots of documents on the web explaining all the various configuration settings that you can provide as system property or as property to launcher.ini but none explains how to set custom properties.
Does anybody have an idea?
Many thanks,
Kai
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转到运行配置,您将获得参数选项卡,在 VM 参数块中您可以提供 -Dpropname=propvalue。如果您有更多值,可以输入空格或换行符分隔它们。
go to the run configuration, you will get the arguments tab, there in VM Arguments block you can provide -Dpropname=propvalue. If you have more values you can enter with space or newline separating them.