Java Eclipse 项目中未绑定的 JavsSE 1.7 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15374697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unbound JavsSE 1.7 libraries in Java Eclipse Project
提问by Shan
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?
我对 Java 和 Eclipse 很陌生。我正在开发一个使用 Jave SE 1.7 的 java 项目。我在 Mac OS 中安装了 Java 1.6 版。我现在已经安装了 Jave SE 1.7 来运行这个项目,但是在项目的库部分显示了JavaSE 1.7 (unbound)
. 该项目无法编译并显示大量错误。如何将 JavaSE 1.7 库与项目绑定?
回答by Romain Hippeau
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.
在您实际安装 jdk 7 之后,您需要告诉 Eclipse。窗口 -> 首选项 -> Java -> 已安装的 JRE。
之后,如果新的 JRE 不是默认的,请告诉您的项目使用哪个 JRE。
回答by Java42
Check these two panels. Remove the unbounded 1.6 JRE and then configure the newly installed 1.7 JRE.
检查这两个面板。删除无界的1.6 JRE,然后配置新安装的1.7 JRE。
回答by greenkode
To add to the above answers, You should also confirm that the project is using a Java 1.7 compiler level.
Right clickon 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
要添加到上述答案,您还应该确认该项目使用的是 Java 1.7 编译器级别。
右键单击该项目并单击Properties。单击 Java Comiler 并检查编译器级别是否也设置为 Java 1.7。见下图
回答by Rohan
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.8 JRE 是未绑定的。解决这个问题的过程还是一样的。
- Go to Eclipse -> Preferences
- Java -> Installed JREs
- You will see Java SE 6 already there and checked.
- To see the other JREs you have installed, click on the "search" button
- 转到 Eclipse -> 首选项
- Java -> 已安装的 JRE
- 您将看到 Java SE 6 已经存在并已检查。
- 要查看您已安装的其他 JRE,请单击“搜索”按钮
5. You will now see the other JREs you have installed, now check mark the JRE you want to use and restart Eclipse.
5. 您现在将看到已安装的其他 JRE,现在选中要使用的 JRE 并重新启动 Eclipse。
回答by lkisac
For Eclipse in Windows:
对于 Windows 中的 Eclipse:
Select Windows->Preferences->Java->Installed JREs->Add.
选择 Windows->Preferences->Java->Installed JREs->Add。
Choose your JRE Type and click Next.
选择您的 JRE 类型并单击下一步。
Select 'Directory...' and find the jre7folder usually located under C:\Program Files\Java\jre, click Finish.
选择“目录...”并找到通常位于C:\Program Files\Java\jre下的jre7文件夹,单击“完成”。
Once it's added, select jre7 and click OK.
添加后,选择 jre7 并单击确定。