从 OS X GUI 启动 jar 时如何设置 java 标志?
我希望当我单击 OS X 中的特定 jar 文件时设置标志“-Xmx1g”。
I want the flag "-Xmx1g" to be set when i click on a particular jar file in OS X.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。通过单击 JAR 文件,OS X 将选择运行 .jar 文件的默认应用程序。这当然是
java
(在 OS X 中称为 Jar Launcher)。您可以做的是将 JAR 包装成可执行文件。 Launch4j 很高兴做到这一点。
第二个选项是编写一个 shell 脚本(bash,但带有
.command
文件扩展名),使用该标志调用您的 jar。You can't. By clicking the JAR file, OS X will choose the default application for running .jar files. Which is of course
java
(which is called Jar Launcher in OS X).What you can do is wrap the JAR into an executable. Launch4j is nice to do this.
Second option is to write a shell script (bash, but with the
.command
file extension) that invokes your jar using that flag.