14

Possible Duplicate:
Eclipse will not open due to environment variables

I'm using eclipse IDE and I tried to run a project, but I'm getting error. It says the javaw.exe cannot be run.

I reinstalled Java, now I have JRE 7 and also I installed Jdk, but still no luck.

I opened cmd to run javaw.exe and it says:

C:\Program Files\Java\jre7\bin>javaw.exe The system cannot find the file C:\Program Files\Java\jre7\bin\javaw.exe

I think eclipse is installed correctly, but I have some trouble with Java. I reinstalled Java for 4 times. I don't know what to do. I can't forward with the tutorial that I'm trying to understand.

Community
  • 1
  • 1
Pop Cristian
  • 173
  • 1
  • 1
  • 4
  • So....is `javaw.exe` in the specified directory? If not, then tell Eclipse where it can find the JDK that you've installed. –  Dec 22 '12 at 17:16

2 Answers2

36

Make sure to download these from here:

enter image description here

Also create PATH enviroment variable on you computer like this (if it doesn't exist already):

  1. Right click on My Computer/Computer
  2. Properties
  3. Advanced system settings (or just Advanced)
  4. Enviroment variables
  5. If PATH variable doesn't exist among "User variables" click New (Variable name: PATH, Variable value : C:\Program Files\Java\jdk1.8.0\bin; <-- please check out the right version, this may differ as Oracle keeps updating Java). ; in the end enables assignment of multiple values to PATH variable.
  6. Click OK! Done

enter image description here

To be sure that everything works, open CMD Prompt and type: java -version to check for Java version and javac to be sure that compiler responds.

enter image description here

I hope this helps. Good luck!

Branislav Lazic
  • 14,388
  • 8
  • 60
  • 85
  • A warning though: IF you already have a PATH variable then you MUST edit it and add ; at the end and then add your path. I made the misstake of just addin "another" PATH on Win 7 but it erased all the other user variable PATHs without asking. – Aron Sep 19 '14 at 11:11
  • Did you read "EDIT" part of my answer? :) – Branislav Lazic Sep 19 '14 at 12:12
  • 1
    Yes but I think it's unclear because your (otherwise good) guide says we should press "New" and add a PATH variable. The EDIT part, IMHO, seem to suggest that we should still be pressing the "New" button but write C:\Program Files\Java\jdk1.7.0\bin; (with a semicolon) . Doing that seems to erase all the old PATH data and therefore we must check before adding whether or not we already have a PATH variable. :) – Aron Sep 19 '14 at 13:19
  • 2
    @Aron I hope this latest update removed all misunderstandings. – Branislav Lazic Sep 19 '14 at 13:36
8

Just update your eclipse.ini file (you can find it in the root-directory of eclipse) by this:

-vm
path/javaw.exe

for example:

-vm 
C:/Program Files/Java/jdk1.7.0_09/jre/bin/javaw.exe
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Zarial
  • 283
  • 3
  • 11