“Cara Upgrade Java dari Java 8 Ke Java 11+ Pada Centos”
Daftar Isi
Pengantar
Terkadang Ketika ada Update versi aplikasi maka java juga harus update dikarenakan versi lama sudah tidak mensuport aplikasi terbaru.
Cara Upgrade Java dari Java 8 Ke Java 11+ Pada Centos
yum update -y
- Cek Versi Java
java -version openjdk version "1.8.0_332" OpenJDK Runtime Environment (build 1.8.0_332-b09) OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
- Install Java 11
yum install java-11-openjdk-devel -y
- Install openjdk 11
yum install java-11-openjdk -y
- Set default Java
sudo alternatives --config java
- Cek Version
java -version openjdk version "11.0.15" 2022-04-19 LTS OpenJDK Runtime Environment 18.9 (build 11.0.15+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+9-LTS, mixed mode, sharing)
- Set Java Home
$ sudo update-alternatives --config java
- List Path Java
#--> path for Java 7 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64/jre/bin/java #--> path for Java 8 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64/jre/bin/java #--> path for Java 11 /usr/lib/jvm/java-11-openjdk-11.0.7.10-4.el7_8.x86_64/bin/java
- Tambahkan Path Java di akhir line
nano ~/.bash_profile JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.7.10-4.el7_8.x86_64/bin/java" atau export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
- verifikasi profile
source ~/.bash_profile echo $JAVA_HOME
- Cara Uninstall Java
[root@localhost ~]# rpm -qa |grep java python-javapackages-3.4.1-11.el7.noarch java-1.8.0-openjdk-devel-1.8.0.332.b09-1.el7_9.x86_64 java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64 javapackages-tools-3.4.1-11.el7.noarch java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64 java-11-openjdk-headless-11.0.15.0.9-2.el7_9.x86_64 java-11-openjdk-devel-11.0.15.0.9-2.el7_9.x86_64 tzdata-java-2022a-1.el7.noarch java-1.8.0-openjdk-headless-1.8.0.332.b09-1.el7_9.x86_64
sudo yum remove java-1.8.0-openjdk-devel
Penutup
Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Upgrade Java dari Java 8 Ke Java 11+ Pada Centos. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.