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

Write a batch or shell script containing the following line. Put into the folder, where MyApp.jar is stored.

java -Xmx256M -jar MyApp.jar

After that always open this batch/script file in order to launch the JAR file.
Although, This will not embed specification of virtual memory size into jar file itself. But, It can override the problem to write the same command often on command line.

Leave a Comment