英文:
How to pass parameters and VM arguments after bundling jar as exe with install4j
问题
我已经使用install4J将我的jar和文件捆绑到一个exe文件中。
它创建了一个名为exe的文件,双击它会打开一个swing窗口,一切都按预期工作。
当这个exe文件还是一个jar文件时,它以两种不同的方式工作。
-
双击,由于没有
String args[]
,它以前会打开一个swing窗口。 -
通过
java -jar test.jar -DFIX_RULES="true" -DTEST="false" C://TestMe C://TestMe2
来调用它,因为我们传递了参数和-D
参数,它以前也可以运行为服务。
现在如何带参数调用exe?有人这样做过吗?
英文:
I have used install4J and bundled my jar and files into an exe.
It creates an exe with the name and when double clicked it opens up a swing window, which works as expected.
When this exe was a jar, it used to work in two different ways.
-
Double click, and as there are no
String args[]
it used to open a swing window. -
Call it via
java -jar test.jar -DFIX_RULES="true" -DTEST="false" C://TestMe C://TestMe2
as here we are passing arguments and-D
args, it used to run as a service too.
How do I call exe with arguments now? Has any one done this?
答案1
得分: 1
要将VM参数传递给由install4j生成的可执行文件,您必须使用“-J”作为前缀,就像在您的示例中一样:
your.exe -J-DFIX_RULES=true -J-DTEST=false C://TestMe
英文:
To pass VM parameters to an executable generated by install4j you have to prefix them with -J
, in your example:
your.exe -J-DFIX_RULES=true -J-DTEST=false C://TestMe
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论