How to change "which java" path to the desired Java version
- open .bash_profile and add the following to make java version as needed ( I needed this for jenkins and maven project as mvn install was failing from the ci_workflow job
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.9.11-0.el7_9.x86_64
export PATH=$JAVA_HOME/bin:$PATH
- simply source the .bash_profile
[root@katello ~]# which java
/usr/lib/jvm/java-11-openjdk-11.0.9.11-0.el7_9.x86_64/bin/java
[root@katello ~]# java -version
openjdk version "11.0.9" 2020-10-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.9+11-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11-LTS, mixed mode, sharing)
[root@katello ~]# date
Tue Dec 8 12:28:18 IST 2020
No comments:
Post a Comment