如何在使用install4j将JAR打包为可执行文件后传递参数和虚拟机参数

huangapple go评论59阅读模式
英文:

How to pass parameters and VM arguments after bundling jar as exe with install4j

问题

我已经使用install4J将我的jar和文件捆绑到一个exe文件中。
它创建了一个名为exe的文件,双击它会打开一个swing窗口,一切都按预期工作。

当这个exe文件还是一个jar文件时,它以两种不同的方式工作。

  1. 双击,由于没有String args[],它以前会打开一个swing窗口。

  2. 通过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.

  1. Double click, and as there are no String args[] it used to open a swing window.

  2. 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 

huangapple
  • 本文由 发表于 2020年8月8日 17:02:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/63313577.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定