简体   繁体   中英

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

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.

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.

It is because Eclipse cannot find the path of javaw.exe

Just edit "eclipse.ini" file, adding this path:

Open the file and attach following sentences (replacing with your own path if different): -vm C:\\Program Files\\Java\\jdk1.7.0_03\\bin\\javaw.exe

Sample:

-startup

plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810

-showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

256m

--launcher.defaultAction

openFile

-vm C:\\Program Files\\Java\\jdk1.7.0_03\\bin\\javaw.exe

-vmargs

-Xms40m

-Xmx384m

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

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.

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

Changing the before file into:

"-vm C:\Program Files\Java\jdk1.7.0_03\bin\javaw.exe" 

solves the problem mentioned earlier

First I had tried to make changes in eclipse.ini file as there was told here, but that did not help.

I simply deleted this .ini file, it helped and Eclipse launched.

Did you try to reinstall Java? Maybe also update to latest version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM