Tuesday, February 11, 2014

How to Set Java Heap Space



1. Open the command or DOS prompt on your computer. To open the prompt, select the Start menu and type 'command' in the search text field followed by the 'Enter' key.

2. Change the DOS directory to the location of the Java program you are going to execute with the larger Java Heap size. To do this, type 'cd \' followed by the fully qualified directory path of the class files. An example of this is:cd c:\myjavafiles

3. Change the max Java Heap size to 128MB through the use of command line arguments on the Java Virtual Machine invocation. To do this, type the following command at the DOS prompt followed by the 'Enter' key:java –Xmx128m YourClassNameHere

4. Exit the Java program run in Step 3. Re-run the Java application setting an initial default Java Heap size of 32MB with the ability to increase the heap size to 128MB if required by typing the following command at the DOS prompt followed by the 'Enter' key:java -Xms32m -Xmx128m YourClassNameHere

No comments:

Post a Comment