Setting/Increase JVM heap size It is possible to increase heap size allocated by the Java Virtual Machine (JVM) by using command line options. Following are few options available to change Heap Size. 1 -Xms< size > set initial Java heap size 2 -Xmx< size > set maximum Java heap size 3 -Xss< size > set java thread stack size For example, you can set minimum heap to 64 MB and maximum heap 256 MB for a Java program HelloWorld. 1 java -Xms64m -Xmx256m HelloWorld