Could not create the Java virtual machine.

I'm running IntelliJ 10 (IU 102-216), JDK 1.6.0_21 from Sun/Oracle, and Windows XP SP3.

I'm having this issue all of a sudden as well, in two different contexts.

The first one is a Spring 3 project that uses Maven.  I can run Maven and download all the dependencies, but when I try to execute a Maven task like compile or package I'm told "Could not create the Java virtual machine".  I can see "-Xmx1042m" in the command that starts Maven, but I can't see where to reset it.

The second one is my first Android project.  I downloaded and installed the Android SDK, but when I try to run the project here is the complete message:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Compilation completed with 1 error and 0 warnings
1 error
0 warnings
Could not create the Java virtual machine.

Here are the contents of my idea.exe.vmoptions:


As you can see, my max heap size is 512 MB.

I thought I was losing my mind, so I re-opened a vanilla Java project and tried to run it - all was well.

What's going on?  What am I doing wrong?   This started happened after I purchased and installed IntelliJ version 10.  Please advise.


Try to lower heap in Settings | Compiler | Android DX compiler. Default is 1024m which may be too high.


Thank you Serge, it's my first try at Android.  I wasn't sure where to make the change.

What's the analogous change for Maven?  Thanks again - Sincerely, Duffy


I figured it out: MAVEN_OPTS is a Windows environment variable.  Reducing it to -Xmx512m sorted it out.  Thanks to all (and Google).


Please sign in to leave a comment.