The NSF XSEDE project will be ending on August 31, 2022 and the new ACCESS project will begin September 1, 2022. Consult Allocation Announcements for key dates related to the XSEDE to ACCESS transition. See Advance to ACCESS for additional information about the new project.

The discussion forums in the XSEDE User Portal are for users to share experiences, questions, and comments with other users and XSEDE staff. Visitors are welcome to browse and search, but you must login to contribute to the forums. While XSEDE staff monitor the lists, XSEDE does not guarantee that questions will be answered. Please note that the forums are not a replacement for formal support or bug reporting procedures through the XSEDE Help Desk. You must be logged in to post to the user forums.

« Back

java heap size error

Combination View Flat View Tree View
Threads [ Previous | Next ]
java heap size error
2/14/16 2:47 AM
Dear forum users,

On using the java -Xmx1200m comand to run a jar file, or using the to compile to a target jar file I got the error:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I tried reducing the heap with the flag -mx128m or -Xmx64m to no avail.

Any idea what is happening and how would I get over this error? Many Thanks! -Victor

BTW if I omit the -mx128m flag I had this version error for java (I posted this question posted a week ago
Exception in thread "main" java.lang.UnsupportedClassVersionError: edu/cmu/ark/QuestionAsker : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at sun.launcher.LauncherHelper.checkAndLoadMain(

RE: java heap size error
3/21/19 10:13 AM as a reply to Victor Shum.
There is not enough virtual memory space requested by an application thus the application fails to start. This usually happens during the application startup phase. Applications reserve a large amount of virtual memory for the JVM heap space during the startup phase. Java on Windows uses an initial size of 16 Megabyte and a maximum of 64 Megabyte.

Most of the time you can fix this problem by uninstalling the Java runtime and then reinstalling it all over again. You can also try increasing the amount of system memory allocated to the Java virtual machine by setting an environment variable.

Open the Control Panel
Go to System
Go to Advanced Systems Properties
Then Environment Variables
In System Variables, click Add
New Variable Name: _JAVA_OPTIONS
New Variable Value: -Xmx512M
Click OK