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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tahir Yasin
  • 11,489
  • 5
  • 42
  • 59

14 Answers14

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.

bluish
  • 26,356
  • 27
  • 122
  • 180
Anish
  • 266
  • 3
  • 2
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

Rahul
  • 15,979
  • 4
  • 42
  • 63
  • 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.). – GoldDragonTSU Sep 09 '13 at 18:35
7

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

Jaffar Ramay
  • 1,147
  • 8
  • 13
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
Samir 007
  • 179
  • 2
  • 8
  • 2
    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. – Timo Riikonen Nov 01 '16 at 08:29
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.

arielduarte
  • 496
  • 4
  • 6
1

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

1

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

rayk
  • 11
  • 1
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..

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.

Gopal00005
  • 2,061
  • 4
  • 35
  • 54
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.

NoWar
  • 36,338
  • 80
  • 323
  • 498
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
Christophe Le Besnerais
  • 3,895
  • 3
  • 24
  • 44
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
0

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

0

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