Every Java program crashes with: Failed to create the java virtual machine

12,717

Solution 1

Carefully move the current JDK / JRE installation to one side, and install a fresh copy. If it works, you are done. If not, you have eliminated the possibility that this is a corrupted installation.

Another possibility is that this is really a path problem. Can you run java -version from a command prompt? Can you compile and run a Java "hello world" program from the command line?

Yes, in theory it could have had a virus ... or someone could have tinkered with the installation.

Solution 2

There are a few sites listing that error that differentiate between the heap and perm space. If you're running this through eclipse, try removing the default perm space value in the eclipse.ini: --launcher.XXMaxPermSize 256m

Solution 3

Sun JVM needs contigous memory block. In windows this could a problem due to dll-rebasing. http://www.drdobbs.com/184416272;jsessionid=HJJRNPUURRDIZQE1GHPCKHWATMY32JVN

Is there any thing else changed?

We got similar problem we installed some new applications(guess it was Citrix) on it. A tool we used was from here http://www.codeproject.com/KB/DLL/RebaseDLLs.aspx (download the code and modify)

If it is left to you, then consider moving to 64bit jvm.

Solution 4

Same problem even i was facing when i first started eclipse.. Just change the value of "–launcher.XXMaxPermSize" in eclipse.ini file..

The eclipse.ini file should now look like this:

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.jee.product
–launcher.defaultAction
openFile
–launcher.XXMaxPermSize
–showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
–launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
Share:
12,717

Related videos on Youtube

Alessandro Dionisi
Author by

Alessandro Dionisi

Enthusiast senior software engineer and passionate scientist of everything regarding the latest technologies and robotics. Preferred programming languages: Java, Python, Go, Bash.

Updated on May 23, 2022

Comments

  • Alessandro Dionisi
    Alessandro Dionisi 5 days

    From yesterday I receive the message: "Failed to create the java virtual machine" in all Java applications in my Windows machine. Maybe I had a virus or something similar. The only advice I found on other sites is to set the heap size to a lower value. The problem is that I have big applications running that requires at least 1024M heap size. Also my machine has 4GB Ram so I think that it isn't a too low memory problem.

    • Shaded
      Shaded about 11 years
      First, if your java program can't even start running I have a hard time believing it's running out of heap space. Second how are you running your program? (command line, netbeans, eclipse... other?)
  • Alessandro Dionisi
    Alessandro Dionisi about 11 years
    I tried to reinstall the JDK/JRE but the problems still remains.
  • Alessandro Dionisi
    Alessandro Dionisi about 11 years
    Ok, I think that this is the problem. There is some tool to help me to rebase all the Windows DLLs? The problem is related to stackoverflow.com/questions/171205/…