I love one-jar and I'm using it on my current project. One problem I would like to circumvent is that I would like the user not to have to worry about setting memory and using a command line interface to increase the heap space.
java -jar -mx512M one-jar.jar
Instead I'd like to control this from within one-jar. Is it possible to do this?
Basically I want to preserve the 'double click' experience and still have the flexibility of increasing Java heap space.
Firstly, you <i>should</i> be using an install script to generate a shortcut to the jar. The shortcut's target string will include the VM heap arguments.
But there is a way workaround: you can recursively execute your program via calls to Process.exec(), attempting to apply the -Xmx (max heap size) argument at each call, but decrementing by some static amount before the call.
There is a post on the Sun forums which works OK but you might want to tidy it up for your specific implementation:
Log in to post a comment.