Setting the Correct Path for Eclipse
I Recently Changed My Path So I Could Follow Along in the Head First Java Book and I Had Eclipse Before. Now When I Try to Get onto Eclipse Again It Won't Open...
I recently changed my path so I could follow along in the Head First Java book and I had Eclipse before. Now when I try to get onto Eclipse again it won't open because it says it can't find a JRE or JDK to use in my directory. I have moved the JDK file around. I have jdk1.8.0_60 downloaded. So how can I get Eclipse to open again?
7 Answers
Eclipse doesn't consult the
JAVA_HOMEvariable
You should specify where Eclipse should find your JDK in the file eclipse.ini. Specifically, the following parameter (note that it is 2 separate lines in the ini file):
-vm
C:\Java\JDK\1.8\bin\javaw.exe
or wherever your javaw.exe happens to be.
Note: The format of the ini file is very particular; make sure to consult to ensure you get it exactly right.
Eclipse folder has an initialization file which is used by eclipse on launch/Double click it is named as eclipse.ini. Add the following lines in eclipse.ini file. Where the vm defines the path of JVM with which we want eclipse to use.
-vm
C:\Program Files\Java\jdk1.8\bin\javaw.exe
Make sure you have add the above lines separately and above the following line
--launcher.appendVmargs
-vmargs
Go to System Properties > Advanced > Enviroment Variables and look under System variables
Must Read
First, create/set your JAVA_HOME variable
Even though Eclipse doesn't consult the JAVA_HOME variable, it's still a good idea to set it. See How do I run Eclipse? for more information.
If you have not created and/or do not see JAVA_HOME under the list of System variables, do the following:
- Click
New...at the very bottom - For
Variable name, typeJAVA_HOMEexactly - For
Variable value, this could be different depending on what bits your computer and java are.- If both your computer and java are 64-bit, type
C:\Program Files\Java\jdk1.8.0_60 - If both your computer and java are 32-bit, type
C:\Program Files\Java\jdk1.8.0_60 - If your computer is 64-bit, but your java is 32-bit, type
C:\Program Files (x86)\Java\jdk1.8.0_60
- If both your computer and java are 64-bit, type
If you have created and/or do see JAVA_HOME, do the following:
- Click on the row under
System variablesthat you seeJAVA_HOMEin - Click
Edit...at the very bottom - For
Variable value, change it to what was stated in #3 above based on java's and your computer's bits. To repeat:- If both your computer and java are 64-bit, change it to
C:\Program Files\Java\jdk1.8.0_60 - If both your computer and java are 32-bit, change it to
C:\Program Files\Java\jdk1.8.0_60 - If your computer is 64-bit, but your java is 32-bit, change it to
C:\Program Files (x86)\Java\jdk1.8.0_60
- If both your computer and java are 64-bit, change it to