1. Download Java
1. Download from the official website
1
2
|
tar -zxvf jdk-8u211-linux-x64.tar.gz # Extract the archive
mv jdk1.8.0_211/ /usr/local/ # Move the JDK to /usr/local
|
Press i to start editing, then add the following lines at the end of the file. Replace /usr/local/jdk1.8.0_211 with your actual installation path:
1
2
3
|
export JAVA_HOME=/usr/local/jdk1.8.0_211
export PATH=.:$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
Then run:
1
2
|
source /etc/profile # Reload environment variables
java -version # Check the installed Java version
|