Error occurred during initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)
Asked Answered
H

14

29

I'm trying to install Java to use Eclipse (I followed all instructions to install Java and Eclipse) but my Eclipse is not starting due to some bad configuration I guess. I can't figure out why it's not working for me.

Eclipse Installation:

  1. Extracted Eclipse at C:\eclipse
  2. Created a shortcut to my desktop having target C:\eclipse\eclipse.exe

When I try to run Eclipse with this shortcut, I see following Eclipse splash screen for a second and it disappears. Eclipse does not start at all.

Eclipse Splash Screen

JAVA Installation:

  1. Installed JDK at C:\Program Files\Java\jdk1.7.0_10
  2. Installed JRE at C:\Program Files\Java\jre7

Environment Variables Configuration:

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_10
PATH = C:\Program Files\Java\jdk1.7.0_10\bin;

I tested my Java installation using the console and figured out this issue but I don't know how to fix it, and I guess this is causing Eclipse not to start.

Problem:

enter image description here

Heterophyllous answered 1/1, 2013 at 8:43 Comment(2)
Were you able to solve the problem?Derian
Thanks, I was able figure on my end. Thanks for the response! :-)Derian
A
25

Go to Eclipse folder, locate eclipse.ini file, add following entry (before -vmargs if present):

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

Save file and execute eclipse.exe.

Aerograph answered 17/7, 2013 at 8:57 Comment(0)
D
10

please try to execute java from

C:\Program Files\Java\jdk1.7.0_10\bin

i.e from the location where java is installed.

If it is successful, it means that the error lies somewhere in the classpath.

Also, this guy seems to have had the same problem as yours, check it out

Differentia answered 1/1, 2013 at 8:55 Comment(1)
The solution mentioned in the link was it for me. To summarize, a different version of the JRE got installed in another dir on the PATH. Moving the desired JDK version to the front of the PATH resolved my issue. Consider exploring this solution if other forces might be able to modify your machine (i.e. other users, automatic updates pushed through by your company, etc.).Determiner
B
7

Check that downloaded eclipse/JDK/JRE is compatible with your processor/OS architecture that is are they 32bit or 64bit?

Breadboard answered 1/1, 2013 at 8:49 Comment(2)
Also, review eclipse.ini. You can add the -vm parameter just in caseInterdictory
@Interdictory How to add -vm parameter, please guide me.Heterophyllous
S
3

Not able to run Appium {“message”:”A new session could not be created. (Original error: ‘java -version’ failed

I used Jdk 1.8 and JRE 1.8, Classpath is also set properly but I observed that Java command gives Error to initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)

Solution:
Uninstalled JRE and JDK completely 
Installed JRE 1.8 then
Installed JDK 1.8 
Set Classpath
check Java command works or not and its working 
also able to execute the Appium program thru Eclipse Kepler Service Release 2 with JDK1.8 support
Shrub answered 23/9, 2016 at 12:16 Comment(1)
This worked for me also. It is easy to test if you have this same issue by giving command "java -version". If it fails, you better reinstall these in this order. Note that you need to uninstall separately JDK 8 update.Anthodium
P
2

I had the same error in my case was when I needed to update jdk 7 to jdk 8, and my bad was just I installed jdk8 and I never installed jre8, only that, the error was solved immediately when I installed jre8.

Phillisphilly answered 3/11, 2015 at 0:9 Comment(0)
S
1

Try placing the desired java directory in PATH before not needed java directories in your PATH.

Sibilla answered 13/5, 2015 at 4:37 Comment(0)
E
1

I had the same issue on Windows 7 and I had to install both JDK and JRE and it's a success.

Encouragement answered 3/11, 2015 at 21:48 Comment(0)
D
1

I faced the same problem,Eclipse splash screen for a second and it disappears.Then i noticed due to auto update of java there are two java version installed in my system. when i uninstalled one eclipse started working.

Thanks you..

Diversified answered 6/5, 2016 at 4:16 Comment(0)
G
1

I've observed this with STS and Eclipse and running java from CMD too on Windows 7/8/10 and following was my simple solution:

Actually, when I installed JDK 8 and STS/Eclipse it created one directory i.e. C:\ProgramData\Oracle\Java\javapath with the following files:

  • C:\ProgramData\Oracle\Java\javapath\java.exe
  • C:\ProgramData\Oracle\Java\javapath\javaw.exe
  • C:\ProgramData\Oracle\Java\javapath\javaws.exe

Along with that, it appended Path Environment variable of System with this location C:\ProgramData\Oracle\Java\javapath

I've just removed above entry from Path Environment variable of System and added the location of the actual JDK instead i.e. C:\Program Files\Java\jdk1.8.0_131\bin

Now that is not necessary to add that -vm option in eclipse.ini or SpringToolSuite4.ini either.

Goulden answered 14/5, 2020 at 4:31 Comment(0)
H
1

Below error is thrown when there are multiple versions of jdk on your machine:

error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object

so for this Just use below:

set PATH="JDK bin path" in cmd

Harvey answered 28/9, 2021 at 3:19 Comment(0)
T
0

I just spent about 1 hour to figure out possible solution for the same error.

So what I did under MS WIndows 7 is following

  1. Uninstall all Java packages of all versions.

  2. Download last packages Java SE or JRE for your 32 or 64 Windows and install it.

  3. First install JRE and second is Java SE.

enter image description here

  1. Open text editor and paste this code.

    public class Hello {

      public static void main(String[] args) {
    
         System.out.println("test");
    
      }
    
    } 
    
  2. Save it like Hello.java

  3. Go to Console and compile it like

javac Hello.java

  1. Execute the code like

java Hello

enter image description here

Should be no error.

Turnsole answered 21/6, 2016 at 17:11 Comment(0)
D
0

sometime you missed some file like I missed my one file rt.java so better to check yours .........

C:\Program Files\Java\jdk1.8.0_112\jre\lib
Dotson answered 28/3, 2018 at 12:16 Comment(0)
D
0
  1. 0

    I just spent about 1 hour to figure out possible solution for the same error.

    So what I did under MS WIndows 7 is following

    Uninstall all Java packages of all versions.

    Download last packages Java SE or JRE for your 32 or 64 Windows and install it.

    First install JRE and second is Java SE.

    1. List item
Dor answered 27/5, 2021 at 12:48 Comment(0)
C
0

I had a same issuse, my file location was in D-drive, and then i shifted to the c-Drive and it works.

Canaanite answered 7/8, 2022 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.