Search code examples
javajarosx-snow-leopard

How to set java flags when launching a jar from the OS X GUI?


I want the flag "-Xmx1g" to be set when i click on a particular jar file in OS X.


Solution

  • I want the flag "-Xmx1g" to be set when i click on a particular jar file in OS X.

    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.