Pages Navigation Menu

Coding is much easier than you think

Solution for “Could not create the Java Virtual Machine” issue

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.

Heap size allocated by the JVM by default can be Increased/Modified by using Java -Xmx/s command line options.

-Xms<size>        set initial Java heap size
-Xmx<size>        set maximum Java heap size


Click here to know about getting JVM heap size, used memory, total memory using Java Runtime programatically.

About Mohaideen Jamil

I'm a Full stack developer of IT exp in J2EE, AngularJs, MicroServices, Docker, Spring (Boot, MVC, Cloud), Bluemix, DevOps. Follow me on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.

%d bloggers like this: