Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error occurred during initialization of VM

 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am getting below error when execute java class file thru "java.exe"

"Error occurred during initialization of VM"

I have done the environmental setup for windows xp. I am able to execute java.exe successfully if am overwriting path environment variable to the jdk\bin folder..

But. if am setting along with existing path variable, i am getting above error.

Please help me out. This is an urgent for me.

Thanks in advance.

 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ganapathi sundaram wrote:This is an urgent for me.

But it isn't for us, so please EaseUp next time.

That said, have you tried reinstalling the JRE?
 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi RobSpoor,

Yes, I did reinstall JRE.. But no use of that new installation. Still the same issue persist.
Please advise.

Thanks in advance..
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you have/had different versions of Java installed and the Path variable has references to more than one installation.
Can you show us what the Path environment variable is set to and also give the installation directory of your latest Java install.
 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,

Thanks for the reply. As you said, I have installed both jdk1.6.0_25 and jdk1.7.0 in my system. But I have set path for 1.6 only along with existing path.

Below is my path environment variable,

C:\Documents and Settings\TestUser>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\In
tel\DMIX;C:\Program Files\Microsoft Application Virtualization Client;C:\Program
Files\RSA Security\RSA SecurID Software Token\;C:\Program Files\Windows Imaging
\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel
\DMIX;C:\Program Files\Microsoft Application Virtualization Client;C:\Program Fi
les\RSA Security\RSA SecurID Software Token\;C:\Program Files\Windows Imaging\;C
:\Program Files\Java\jdk1.6.0_25\bin;

Though i have set the path for 1.6 alone. Still, i am facing the same one. Please suggest to move forward.

Thanks in advance.
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your first post you said you got it working by specifying the path to the jdk\bin, can you show what command you used that did not work (and the full error message) and also the one that did work.
 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,

Below one which i was tried to overwrite the path..

C:\Documents and Settings\TestUser>set PATH=C:\Program Files\Java\jdk1.6.0_25\bin

C:\Documents and Settings\TestUser>javac test1.java

C:\Documents and Settings\TestUser>java test1
Hello World..!

C:\Documents and Settings\TestUser>path
PATH=C:\Program Files\Java\jdk1.6.0_25\bin

C:\Documents and Settings\TestUser>

below is the full error message when i execute the same class

C:\Documents and Settings\TestUser>java test1
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

C:\Documents and Settings\TestUser>

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have lost the rest of the PATH.
Try
set PATH="C:\Program Files\Java\jdk1.6.0_25\bin";%PATH%
You probably need the "quotes", because there is a space in the path. You might have to move the closing quote later; I am not sure.
Make sure the PATH to your JDK installation comes first; then you will not get confused by finding any other Java instances in other directories.
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try entering the following at the command line (without setting the path) and post the result.:


BTW as an aside, looking at you post where you showed the contents of your PATH environment variable I've just noticed it lists most entries twice. You may want to edit it to remove the duplicates.
 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Tony,

Full error message,
-----------------------

C:\Documents and Settings\TestUser>java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

Java Version:
-----------------

C:\Documents and Settings\TestUser>set PATH=C:\Program Files\Java\jdk1.6.0_25\bin

C:\Documents and Settings\TestUser>java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Client VM (build 20.0-b11, mixed mode, sharing)

C:\Documents and Settings\TestUser>

Thanks in advance..!
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure, but I suspect it's trying to run from the jdk 1.7 installation.
Have you tried doing as Campbell suggested and put the path to the jdk 1.6 installation at the front of the PATH environment variable. Failing that you could try un-installing jdk 1.7 and see if the problem goes away.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ganapathi sundaram wrote:C:\Documents and Settings\TestUser>java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

That seems to indicate that the JVM can't find its own rt.jar file. This is the file that includes the class files for Object, String etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic