Solution for “Could not create the Java Virtual Machine” issue
If you get the below error message while executing java program
Error:Could not create the Java Virtual Machine. Error:A fatal exception has occurres.Program will exit.
To resolve this issue, following steps are needed to be followed (on Windows XP, Windows 7, Windows 8):
- Right Click on My Computer Icon and click on Properties
- Click on Advanced Systems Settings
- Then Environment Variables
- Under System Variables, click New
- In which give Variable Name as: _JAVA_OPTIONS
- Variable Value: -Xmx1024m
- Click OK
That’s it, now your Java program should execute properly.
Note:
Heap size allocated by the JVM by default can be Increased/Modified by using Java -Xmx/s command line options.
Where -Xmsset initial Java heap size -Xmx set maximum Java heap size
I tried this, still not working.
I;m running windows 8 x64, installed Java x64.
Tried for hours now, deinstalled it, removed all remaining folders of Java 6 and x84 version.
Any suggestions?
Thanks
For 64bit OS I have seen heap size of 2048 recommended. That’s what I use.