简体   繁体   English

如何将JDK版本从1.6自由更改为1.7?

[英]How to change JDK version from 1.6 to 1.7 in liberty?

I am using websphere 8.5 liberty server to deploy my .EAR application . 我正在使用Websphere 8.5自由服务器部署我的.EAR应用程序。 After running java -version command i can see 运行java -version命令后,我可以看到

Java version "1.6.0_38"
OpenJDK Runtime Environment (IceTea6 1.13.10) (rhe1-1.13.10.0.e17_2-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-bo1, mixed mode) 

Now i just want to change the Java version to 1.7 . 现在我只想将Java版本更改为1.7 Should websphere 8.5 liberty server support 1.7 and 1.8 ? Websphere 8.5自由服务器应支持1.7和1.8吗? How can i change the path ? 如何更改路径? Please proved any steps . 请证明任何步骤。

Websphere Liberty supports 1.6, 1.7 and 1.8 JVM from different vendors (IBM, Oracle). Websphere Liberty支持来自不同供应商(IBM,Oracle)的1.6、1.7和1.8 JVM。 If you want to point it do the specific JVM just create server.env file in the server directory and define JAVA_HOME variable there like this: 如果要指向它,请执行特定的JVM,只需在服务器目录中创建server.env文件并在其中定义JAVA_HOME变量,如下所示:

JAVA_HOME=C:\wlp\java

Running java -version doesn't tell you anything about JVM used by Liberty, as it just is using default Java from the system. 运行java -version不会告诉您有关Liberty使用的JVM的任何信息,因为它只是使用系统中的默认Java。 You can see which JVM is used by Liberty in the messages.log eg: 您可以在messages.log查看Liberty使用的JVM,例如:

Launching defaultServer (WebSphere Application Server 8.5.5.9/wlp-1.0.12.cl50920160227-1523) 
on IBM J9 VM, version pwi3280sr1ifx-20150513_01 (SR1+IX90162+IV73188 SR1+IX90162+IV73188) (en_us)

You can also download latest Liberty bundled with Java8 from here https://developer.ibm.com/wasdev/downloads/#asset/runtimes-webprofile7-ibm-java 您也可以从此处https://developer.ibm.com/wasdev/downloads/#asset/runtimes-webprofile7-ibm-java下载与Java8捆绑在一起的最新Liberty。

under WLP directory create a new directory called "etc". 在WLP目录下,创建一个名为“ etc”的新目录。 inside the etc directory , create a file called "server.env" open server.env file for editing and add the following 在etc目录中,创建一个名为“ server.env”的文件,打开server.env文件进行编辑并添加以下内容

JAVA_HOME={path_to_java}

This sets the java for all the servers you create under that liberty installation. 这将为您在该自由安装下创建的所有服务器设置java。

if you want to customize at server level , then create the server.env file under the server home location wlp/usr/servers/{server_name} , with the same contents as described abovev 如果要在服务器级别进行定制,请在服务器主目录wlp / usr / servers / {server_name}下创建server.env文件,其内容与上述内容相同v

WAS Liberty doesn't bundle a version of Java and can run using any certified Java such as the system Java or any Java that you have defined in your environment. WAS Liberty不捆绑Java版本,可以使用任何经过认证的Java(例如系统Java或您在环境中定义的任何Java)运行。 Liberty will use the Java specified in the JAVA_HOME or JRE_HOME environment variables before using a Java that may be found in the PATH. 在使用可能在PATH中找到的Java之前,Liberty将使用JAVA_HOME或JRE_HOME环境变量中指定的Java。 Further information can be found in README.txt that provided in the root directory of your Liberty installation. 可以在Liberty安装的根目录中提供的README.txt中找到更多信息。

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

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