I have the following setup (on multiple machines with RHEL7):
$ which java
/usr/bin/java
$ ls -ltr /usr/bin/java
/usr/bin/java -> /etc/alternatives/java
$ ls -ltr /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242b08-1.e17.x86_64/jre/bin/java
$ echo $JAVA_HOME
/etc/alternatives/jre_1.8.0_openjdk
$ ls -ltr /etc/alternatives/jre_1.8.0_openjdk
/etc/alternatives/jre_1.8.0_openjdk -> /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242-1.e17.x86_64
I need to update to version 251 so I took the corresponding .tar.gz from artifactory , extract it in /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.251 and now I need to update all the simlink in order to use the latest java version.
Using the man pages of alternatives I did:
alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.251/bin/java
Which modified /etc/alternatives/java but due to the fact that $JAVA_HOME=/etc/alternatives/jre_1.8.0_openjdk I need to modify/update /etc/alternatives/jre_1.8.0_openjdk .
I am not sure what to put as the <link> in alternatives --install <link> <name> <path> <priority> in order to update /etc/alternatives/jre_1.8.0_openjdk.
I'm not even sure that this is the correct approach towards updating java version . Thx
/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.251/binto yourPATHand/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.251/libto yourLD_LIBRARY_PATH and then set theJAVA_HOME` as/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.251.