Issue
java - version in DOS shows the version to be
java version "1.8.0_91".
However, my code http://pastebin.com/kSZKszYy in Eclipse is showing major.minor error 52. A little research told me there was a mismatch in my code and the JDK version I am running. In windows->preferences I found out my JDK to be version 1.7.
I could not try and import 1.8 which is supposedly already present on my computer.
A step by step approach of how to import the newer version of JDK will be appreciated.
JDK version I have installed is jre-8u91-windows-x64.exe.
My Machine runs on windows 10 and has a 64 bit architecture.
I am running Eclipse Mars.
Solution
Inside Eclipse you can easily select the JRE that you want to use for your specific project or all of your projects in your workspace through the preference pane. To change the JRE for all your projects in your workspace you can :
- Window -> Preferences
- Select Java an open the drop down
- Select Installed JRE
- Add the new JRE (in your case 1.8.0_91)
In the picture above you can see that I have two JREs available (1.7 and 1.8.0_92) and I choose to use the version 7 instead of the latest 1.8.
To add a JRE, you have to :
- Press Add on the Installed JREs pane
- Select Standard VM
- On the JRE home select the home directory of your new JRE
- Click on Finish
After selecting the new JRE you may need to select the compiler compliance level to the version of the new JVM you have selected, here is an example :
Answered By - aleroot
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)