Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runnable jar with jvm args

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?

like image 402
Avi Y Avatar asked Feb 13 '10 10:02

Avi Y


1 Answers

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.

like image 126
Brian Agnew Avatar answered Nov 08 '22 10:11

Brian Agnew