如何在 Eclipse 中将 Eclipse 和 Eclipse 项目指向新的 JRE 版本?(不使用 JAVA_HOME)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11530811/
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
How do you point your Eclipse and Eclipse projects to a new JRE version in eclipse? (Not using JAVA_HOME)
提问by Dale
Setting up scenario : I have two version of Java on my system. A 32 bit version and a 64 bit version. The other version I have is the 64 bit version of Eclipse (Java EE). The MyEclipse (32 bit version) is pointing to the 32 bit version of the JDK. I'm now trying to point the Eclipse (32 bit version) at the newly installed JDK 1.6.0_32. the JAVA_HOME variable is already take by the 64 bit version and thus I can't use this.
设置场景:我的系统上有两个版本的 Java。一个 32 位版本和一个 64 位版本。我拥有的另一个版本是 64 位版本的 Eclipse (Java EE)。MyEclipse(32 位版本)指向 JDK 的 32 位版本。我现在试图将 Eclipse(32 位版本)指向新安装的 JDK 1.6.0_32。JAVA_HOME 变量已经被 64 位版本占用,因此我不能使用它。
Previously this environment and projects in this environment were usinig Java 1.6.0_30. The places where I've changed the JRE version are in Preferences->Java->Installed JREs. In here I've added my new JRE and removed the old one. What other places might I need to change this? I'm still getting an error referring to 1.6.0_30 when I start up my Apache Tomcat server. In specific I get the error "The archive:Files/Java/jdk1.6.0_30/lib/tools.jar which is referenced by the classpath, doesn't exist. "
以前此环境和此环境中的项目使用 Java 1.6.0_30。我更改 JRE 版本的位置在 Preferences->Java->Installed JREs 中。在这里,我添加了我的新 JRE 并删除了旧的。我可能需要在哪些其他地方更改此设置?当我启动我的 Apache Tomcat 服务器时,我仍然收到一个关于 1.6.0_30 的错误。具体来说,我收到错误“由类路径引用的存档:Files/Java/jdk1.6.0_30/lib/tools.jar,不存在。”
Looking in the class paths of my projects I see the correct 1.6.0_33 version. Where else might I need to change the classpath?
查看我的项目的类路径,我看到了正确的 1.6.0_33 版本。我还需要在哪里更改类路径?
Thanks in advance.
提前致谢。
回答by Luiggi Mendoza
Go to Window/Preferences/Server/Runtime Environment, select your server (Apache Tomcat), click Edit. There is the JRE that uses your server, you can change it according to your needs.
转到窗口/首选项/服务器/运行时环境,选择您的服务器(Apache Tomcat),单击编辑。有使用您服务器的 JRE,您可以根据需要更改它。
回答by ManMohan Vyas
one way to correct this error is :
纠正此错误的一种方法是:
find tools.jar in jre/lib folder and copy the same in required folder /Java/jdk1.6.0_30/lib/ .
在 jre/lib 文件夹中找到 tools.jar 并将其复制到所需文件夹 /Java/jdk1.6.0_30/lib/ 中。