在 Eclipse 中设置 JDK

在 Eclipse 中设置 JDK

问题描述:

我有两个 JDK,分别用于 Java 6 和 7.

I have two JDKs, for Java 6 and 7.

我想同时使用两者来构建我的项目.最初我们只针对 1.6 构建.我在我的项目设置中看到我可以选择 1.5、1.6 1.7 作为编译器级别.

I want to build my project using both. Initially we only built against 1.6. I see in my project setting I can select 1.5, 1.6 1.7 as the compiler level.

这些选项是如何添加到 IDE 中的?我从未安装过 Java 1.5.假设我想要 Java 1.4.我怎样才能让它出现在列表中?我在 IDE 首选项中添加了两个不同的 JRE,但下拉列表中没有显示这些.

How are these options added to the IDE? I never installed Java 1.5. Suppose I wanted Java 1.4. How would I get this to appear in the list? I have added two different JREs in my IDE preferences, but these are not what appears in the dropdown.

您可以在 Window 中管理可用编译器的列表 ->首选项 ->Java ->安装了 JRE 的标签.

在项目构建路径配置对话框中,在libraries选项卡下,您可以删除JRE System Library的条目,点击Add Library并选择安装的JRE编译.某些编译器可以配置为在后级编译器版本下进行编译.我认为这就是您看到附加版本选项的原因.

In the project build path configuration dialog, under the libraries tab, you can delete the entry for JRE System Library, click on Add Library and choose the installed JRE to compile with. Some compilers can be configured to compile at a back-level compiler version. I think that's why you're seeing the addition version options.