Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ever since the latest update, the Java installation has been corrupted. Any program requiring Java simply doesn't open, and in the command line if I try to run a program using Java MyJavProg I get the message Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object.

Should I uninstall everything Java related and reinstall?

share|improve this question
up vote 1 down vote accepted

I have had success with this type of problem by uninistalling, reinstalling Java. What have you to loose I ask? Java is freely available. (Just avoid the free toolbar add-ons).

share|improve this answer
Might help, although I hope you know he's talking about JDK and not JRE, for which manual editing of PATH and CLASSPATH is required? – Karan Jan 16 '13 at 7:15
@Karan In truth I missed that. One feature of my answers is to start with the most obvious solutions, just in case the asker had overlooked a quick and easy fix. – Guy Thomas Jan 16 '13 at 8:33

The likely problem is that your path is targeting the wrong version of java.

Try the following first (I'm assuming a Windows installation):

Navigate to your %PROGRAMFILES%\Java folder

You may see multiple installations of Java - look for the most recent update (assuming the install had no errors)

Launch a command prompt within your %PROGRAMFILES%\Java folder and then change to the relevant java version and retry your commands from the bin folder using the full path to your java file(s). If it works then we have found the culprit.

You now need to edit your environment variables to point to the correct path.

Go to your environmental variables, and edit the PATH (CLASSPATH if necessary), changing

On 32 bit Windows

"C:\Program Files\Java\jdkINCORRECTJAVAVERSION\bin\" to
" C:\Program Files\Java\CORRECTJAVAVERSION\bin\"

On 64 bit Windows

"C:\Program Files (x86)\Java\jdkINCORRECTJAVAVERSION\bin\" to
"C:\Program Files (x86)\Java\CORRECTJAVAVERSION\bin\"

share|improve this answer
If I navigate to C:\Program Files\Java\jdk1.7.0_02\bin and run java.exe from there I can sucesfully run Java programs. However, this is already in the PATH environment variable...I notice you said (X86) for Windows 64 bit. I'm on 64 bit but Java is installed in the normal program files – Celeritas Jan 16 '13 at 6:33
@Celeritas: Yes, install 64-bit JDK on 64-bit Windows. What is your CLASSPATH set to? – Karan Jan 16 '13 at 16:48
C:\Program Files\Java\jdk1.7.0_02\bin; is in my PATH variable. I don't have a CLASSPATH variale? – Celeritas Jan 16 '13 at 20:48
One thing you can check is running java --version and see if it reports the correct version for what you are expecting. If you get a different version it could be you have the java binary sitting in a folder higher up in the path. Also make sure there is only one reference to the JDK in your path (in case of multiple installs.) Please check the following link for setting the PATH and CLASSPATH variables:… – Enigman Jan 16 '13 at 22:52
I can't run Java --version. Link doesn't contain instructions for the class path on Windows 7. – Celeritas Jan 17 '13 at 5:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .