简体   繁体   中英

Unbound JavsSE 1.7 libraries in Java Eclipse Project

I am very new to Java and Eclipse. I am working on a java project that uses Jave SE 1.7 . I had Java version 1.6 installed in Mac OS. I have installed now Jave SE 1.7 to run this project, but in the libraries section of the project shows JavaSE 1.7 (unbound) . The project does not compile and show lots of error. How can I bind the JavaSE 1.7 library with the project?

After you actually install jdk 7, you need to tell Eclipse about it. Window -> Preferences -> Java -> Installed JREs.
After that tell your project which JRE to use if the new one is not the default one.

Check these two panels. Remove the unbounded 1.6 JRE and then configure the newly installed 1.7 JRE.

在此输入图像描述

在此输入图像描述

To add to the above answers, You should also confirm that the project is using a Java 1.7 compiler level. Right click on the the project and click Properties . Click Java Comiler and Check that the compiler level is also set to Java 1.7. See the image below 在此输入图像描述

Hi I was also having this problem but for me 1.8 JRE was unbound. The process to solve this is still the same.

  1. Go to Eclipse -> Preferences
  2. Java -> Installed JREs
  3. You will see Java SE 6 already there and checked.
  4. To see the other JREs you have installed, click on the "search" button

在此输入图像描述 5. You will now see the other JREs you have installed, now check mark the JRE you want to use and restart Eclipse.

For Eclipse in Windows:

Select Windows->Preferences->Java->Installed JREs->Add.

在此输入图像描述

Choose your JRE Type and click Next.

在此输入图像描述

Select 'Directory...' and find the jre7 folder usually located under C:\\Program Files\\Java\\jre , click Finish.

在此输入图像描述

Once it's added, select jre7 and click OK.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM