带有jvm参数的Runnable jar [英] Runnable jar with jvm args
问题描述
问题是我添加到Eclipse中的运行配置的vm参数没有以任何方式保存。
我知道我可以创建一个使用需要的参数来运行jar的批处理文件,但是我更喜欢我的用户将只运行jar本身。
我的问题是,有没有办法通过命令行将vm参数传递给runnable jar?
简而言之,如果没有某种形式的包装,你不能这样做。您可以编写.bat文件和/或.sh脚本以适当的设置来调用JVM。
您可能还想查看 JavaServiceWrapper ,它提供了一个用可执行文件包装一个.jar的方法,并让它作为独立的或服务运行(尽管它的名字)。它具有一系列功能,可以让您以各种各样的时尚控制JVM执行。
I was trying to create a runnable jar file using Eclipse.
The problem is that the vm parameters I have added to the run configuration in the Eclipse were not saved in any way.
I know I can create a batch file that will run the jar with the needed arguments, but I would prefer my users will just run the jar itself.
My question is therefore, is there any way to pass vm arguments to the runnable jar not by command line?
Briefly, you can't do this without some form of wrapper. You can write a .bat file and/or a .sh script to invoke the JVM with appropriate settings.
You may also want to check out JavaServiceWrapper, which provides a means to wrap a .jar with executable params and let it run as a standalone or service (despite its name). It has a set of features to allow you to control the JVM execution in a variety of fashions.
这篇关于带有jvm参数的Runnable jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!