Hello, everyone, it’s time for the daily tip again. Today I want to introduce to you how to upgrade the ava version that comes with the system using source code installation!
First, we need to check what version of Java comes with our system. How to check it?
java -version
As you can see, my system java version is 1.8.0_372d!
So assuming we want to upgrade to java17 version, how to achieve it?
First check where java is installed?
which java
Secondly delete the storage location of java!
Method 1: The deletion is not clean, but it is recommended.
rm -rf /ur/bin/java
Method 2: rpm -ql java Use rpm -e to uninstall java
Secondly, upload the source code package
rz jdk-17_linux-x64_bin.tar.gz
Unzip, move
ls view
Configure the /etc/profile file to let your system recognize this jdk
export JAVA_HOME=/usr/local/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jarIt’s not the most complete one, but it’s simplified and can be used!
source /etc/profile
Finally, check the java version!
java -version