Can I set Java max heap size for running from a jar file?

后端 未结 8 1775
刺人心
刺人心 2020-11-28 10:16

I am launching a java jar file which often requires more than the default 64MB max heap size. A 256MB heap size is sufficient for this app though. Is there anyway to speci

8条回答
  •  抹茶落季
    2020-11-28 10:48

    There are many ways of doing it:

    You can by having another Jar file which triggers your main Jar.

    Or, have a batch file which will start your jar. But be careful, if downloaded from say net, the user will have to set permissions for the script to be runnable

    Build an installer. On Mac, using the Oracle Java App bundler for Java 7, Apple App bundler for Java 6 build the .app file. You still cant redistribute it as the necessary permissions wont be set. Build a dmg for the app file. This can be used for distribution. A similar installer for Windows

    The third technique would be the best, as you can then package the dependencies well, set all JVM arguments etc

提交回复
热议问题