我如何配置 Eclipse 以使用不同版本的 JDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4638108/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:37:27  来源:igfitidea点击:

How do i configure eclipse to make use of different version of JDK

eclipse

提问by Rinkal Bhanderi

I have three project running on eclipse i want to use JDK 1.4for two project and JDK 1.6for third project how do i do that?

我在 eclipse 上运行了三个项目,我想JDK 1.4用于两个项目和JDK 1.6第三个项目,我该怎么做?

回答by VonC

You need:

你需要:

alt text

替代文字

The default JRE is shown with a check mark and is used by new eclipse projects unless the project specifically overrides the value.
So the next step is to check which JRE the current project is using.

  • Right click the project and choose "properties".
  • Select "Java Build Path" and then click the tab labeled "Libraries". You should see an entry like "JRE System Library [version]".
    To change the JRE version,
    • highlight the entry and click "Remove".
    • Then click "Add Library...". Choose "JRE System Library".
      If you choose "Workspace Default", the project will use the JRe defined under "Windows -> Properties" as explained above.
      You may also specify an alternate JRE located somewhere on your file system, or choose an embedded execution environment provided by Eclipse.

默认 JRE 显示有复选标记,并由新的 eclipse 项目使用,除非项目明确覆盖该值。
所以下一步是检查当前项目使用的是哪个 JRE

  • 右键单击项目并选择“属性”。
  • 选择“Java Build Path”,然后单击标有“Libraries”的选项卡。您应该会看到类似“JRE 系统库 [版本]”的条目。
    要更改 JRE 版本,
    • 突出显示该条目并单击“删除”。
    • 然后单击“添加库...”。选择“JRE 系统库”。
      如果选择“Workspace Default”,项目将使用在“Windows -> Properties”下定义的 JRe,如上所述。
      您还可以指定位于文件系统某处的备用 JRE,或选择 Eclipse 提供的嵌入式执行环境。

回答by p27

you can configure VM in eclipse.inifile.

您可以在eclipse.ini文件中配置 VM 。