2

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.

Alessandro Dionisi
  • 2,494
  • 4
  • 33
  • 37
  • 2
    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?) – Shaded Mar 03 '11 at 15:49
  • Yes they work before yesterday. I can't execute Maven, Eclipse, SQLDeveloper and Tomcat! – Alessandro Dionisi Mar 03 '11 at 15:59

8 Answers8

4

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
1

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

Riggy
  • 1,347
  • 1
  • 14
  • 26
1

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.

Jayan
  • 18,003
  • 15
  • 89
  • 143
  • 1
    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 http://stackoverflow.com/questions/171205/java-maximum-memory-on-windows-xp – Alessandro Dionisi Mar 04 '11 at 08:16
1

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
Shishir
  • 11
  • 1
0

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

John Ashmore
  • 1,015
  • 1
  • 10
  • 25
0

Changing the before file into:

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

solves the problem mentioned earlier

user
  • 86,916
  • 18
  • 197
  • 190
Learner
  • 5,192
  • 1
  • 24
  • 36
0

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.

Pranav 웃
  • 8,469
  • 6
  • 38
  • 48
Alexis
  • 1
0

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

Puce
  • 37,247
  • 13
  • 80
  • 152