aspose file tools*
The moose likes Java in General and the fly likes Error occurred during initialization of VM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Error occurred during initialization of VM" Watch "Error occurred during initialization of VM" New topic
Author

Error occurred during initialization of VM

ganapathi sundaram
Greenhorn

Joined: Feb 09, 2010
Posts: 14
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

Joined: Oct 27, 2005
Posts: 19762
    
  20

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?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
ganapathi sundaram
Greenhorn

Joined: Feb 09, 2010
Posts: 14
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

Joined: Aug 07, 2007
Posts: 2366
    
  50
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

Joined: Feb 09, 2010
Posts: 14
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

Joined: Aug 07, 2007
Posts: 2366
    
  50
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

Joined: Feb 09, 2010
Posts: 14
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

Joined: Oct 13, 2005
Posts: 39869
    
  28
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

Joined: Aug 07, 2007
Posts: 2366
    
  50
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

Joined: Feb 09, 2010
Posts: 14
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

Joined: Aug 07, 2007
Posts: 2366
    
  50
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

Joined: Oct 27, 2005
Posts: 19762
    
  20

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error occurred during initialization of VM