简体   繁体   中英

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 . After running java -version command i can see

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 . Should websphere 8.5 liberty server support 1.7 and 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). 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:

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. You can see which JVM is used by Liberty in the messages.log eg:

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

under WLP directory create a new directory called "etc". inside the etc directory , create a file called "server.env" open server.env file for editing and add the following

JAVA_HOME={path_to_java}

This sets the java for all the servers you create under that liberty installation.

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

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. 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. Further information can be found in README.txt that provided in the root directory of your Liberty installation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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