简体   繁体   English

Eclipse 错误:选择了 JRE,但路径无效

[英]Eclipse error: JRE is selected, but the path is invalid

I have a Java web application I work on using an Eclipse IDE.我有一个使用 Eclipse IDE 处理的 Java Web 应用程序。 I'm using WebLogic 12c.我正在使用 WebLogic 12c。

I recently had the jdk upgraded from jdk1.7.0_55 to jdk1.7.0_79.我最近将 jdk 从 jdk1.7.0_55 升级到 jdk1.7.0_79。

Since then, I can't get anything to build;从那以后,我无法建造任何东西; and I can't even start my local WebLogic server.我什至无法启动本地 WebLogic 服务器。

I reset my JAVA_HOME environment variable to the new path, and I also opened the properties of the project - and set the JRE System Library to jdk1.7.0_79.我将我的 JAVA_HOME 环境变量重置为新路径,并且我还打开了项目的属性 - 并将 JRE 系统库设置为 jdk1.7.0_79。

However, no dice.然而,没有骰子。 If I try to build using my ANT script, I get the following error:如果我尝试使用我的 ANT 脚本构建,我会收到以下错误:

在此处输入图片说明

So it's obviously still looking for the old jdk1.7.0_55 installation - but I don't know why or where.所以它显然仍在寻找旧的 jdk1.7.0_55 安装 - 但我不知道为什么或在哪里。

Then if I even try to start the localhost server, I get this然后,如果我什至尝试启动本地主机服务器,我就会得到这个

在此处输入图片说明

If I try to add a new server, I get the same error.如果我尝试添加新服务器,则会出现相同的错误。

Any suggestions?有什么建议?

Thanks!谢谢!

Try this... In Eclipse, go to the Servers menu and right click 'New.'试试这个... 在 Eclipse 中,转到 Servers 菜单并右键单击“New”。 In the 'New Server' window find the 'Configure runtime environments' link ( See Pic 1 ) and once there you then click the server that needs the updated JRE upgrade and then Click 'Edit'.在“新服务器”窗口中找到“配置运行时环境”链接(参见图 1 ),然后单击需要更新 JRE 升级的服务器,然后单击“编辑”。 In the Edit Server Runtime Environment Window there should be a Java home textfield where you can put the jdk that you upgraded to.在“编辑服务器运行时环境”窗口中,应该有一个 Java 主页文本字段,您可以在其中放置升级到的 jdk。 ( See Pic 2 ) 见图2

NOTE: This was done in Eclipse Kepler in the time of this writing.注意:在撰写本文时,这是在 Eclipse Kepler 中完成的。 Should work in later versions as well.也应该在以后的版本中工作。

In your weblogic installation (or more exactly, in your domain), check the file setDomainEnv.cmd.在您的 weblogic 安装中(或者更准确地说,在您的域中),检查文件 setDomainEnv.cmd。 Weblogic stores some absolute paths to the jdk itself. Weblogic 存储一些到 jdk 本身的绝对路径。 You will have to edit this file manually.您必须手动编辑此文件。

Sample paths from my machine for comparison:来自我的机器的示例路径以进行比较:

wls12130\user_projects\domains\mydomain\bin\setDomainEnv.cmd (3 hits)
    Line 46: set SUN_JAVA_HOME=C:\develop\jdk1.8.0_66
    Line 48: set DEFAULT_SUN_JAVA_HOME=C:\develop\jdk1.8.0_66
    Line 65:        set JAVA_HOME=C:\develop\jdk1.8.0_66

You need to update the WebLogic installation and let it know where to find the new JDK.您需要更新 WebLogic 安装并让它知道在哪里可以找到新的 JDK。

Unfortunately, the JDK path is written into several configuration files, both in the Domain and in the Weblogic installation directory.不幸的是,JDK 路径被写入了几个配置文件,都在 Domain 和 Weblogic 安装目录中。 And also in the directories of other products that are part of Oracle Fusion Middleware.并且也在属于 Oracle 融合中间件的其他产品的目录中。

Here is a sample list of files that may need to be updated if you change the JDK installation directory:以下是更改 JDK 安装目录时可能需要更新的文件示例列表:

$ORACLE_HOME/install/envVars.properties
$ORACLE_HOME/oracle_common/common/bin/commEnv.sh
$ORACLE_HOME/oracle_common/common/bin/setHomeDirs.sh
$ORACLE_HOME/oui/.globalEnv.properties  (12.2.1)
$ORACLE_HOME/oui/bin/compareInventory.sh
$ORACLE_HOME/oui/bin/install.sh
$ORACLE_HOME/oui/bin/viewInventory.sh
$ORACLE_HOME/wlserver/.product.properties

$DOMAIN_HOME/bin/setDomainEnv.sh
$DOMAIN_HOME/bin/setNMJavaHome.sh  (12.2.1)
$DOMAIN_HOME/nodemanager/nodemanager.properties

References (provided without links, because links into the Oracle site tend to decay rapidly):参考资料(不提供链接,因为进入 Oracle 站点的链接往往会迅速衰减):

How to Install and Maintain the Java SE Installed or Used with FMW 11g/12c Products (Doc ID 1492980.1)如何安装和维护与 FMW 11g/12c 产品一起安装或使用的 Java SE(文档 ID 1492980.1)

How to Upgrade the JDK Used by Oracle WebLogic Server 12c to a Different Version (Doc ID 1616397.1)如何将 Oracle WebLogic Server 12c 使用的 JDK 升级到不同版本(文档 ID 1616397.1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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