Setup eclipse java SE-1.7

17,711

Solution 1

You may not have your JDK/JRE set up correctly.

Check the following:

  • Did you install a JDK or just the JSE? The JDK is needed to compile .java files to .class files. Without it, you can only run java programs, not develop them. If not, download and install it from Oracle website.

  • Check in Eclipse, if you have the JRE installed there as well. You just need to specify the path to the installation. You can reach this screen via the "Window->Prefrences" menu. see this screenshot:

enter image description here

The message you receive about project specific compiler compliance level is not a problem, it just means that your workspace is set up to comply to java 1.6 but your project will comply to java 1.7 standards. Also, Java 7 in general is no problem whatsoever.

Paths may differ, especially if you're not running a *nix OS. Just point the location to where you installed your JDK.

Solution 2

Check your Eclipse preferences: Java -> Installed JREs. The one that you're using should be marked and it should be a JDK not just a JRE.

Also check your project's build path: Right click on the project -> Properties -> Java Build Path Check in the "libraries" folder whether the JRE System Library is present and if not add it using "Add library"->"JRE System Library" and then select the correct one (from an installed JDK).

Share:
17,711
John
Author by

John

Updated on June 04, 2022

Comments

  • John
    John almost 2 years

    I wanted to start learning java but Eclipse is giving me some trouble.

    First of all I'm a beginner with Java with little to no knowledge about it. I want to use 'JavaSe-1.7'. I have no clear reason to use it besides using the latest version. After downloading Eclipse (Eclipse IDE for Java Developers) I created a new Java project and selected 'use an execution eviorment JRE : JavaSE-1.7'. This directly popped the notification saying 'The default compiler compliance level for the current workspace is 1.6. The new project will use a project specific compiler compliance level of 1.7.'. I finished creating the project and started following some tutorials.

    However I noticed directly I have 2 errors which dont explain anything or have a source. I ignored it and started typing and tried to import 'java.io.console' however it said 'The import java.io cannot be resolved' and I have no idea what is the cause of it neither how to fix this.

    Would like some instructions into the right direction.

    Thanks in advance