Installation of JDK1.8 under Linux system tutorial details
- 2020-12-18 01:59:13
- OfStack
1. Cleaning before installation
rpm -qa | grep jdk
rpm -qa | grep gcj
yum -y remove java-xxx-xxx
2. Download JDK online
Command:
[wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
]Download read bar:
To see if there is an JDK installation package under the current folder:
Add execution permission:
Command:
chmod +x jdk-8u131-linux-x64.rpm
Perform rpm for installation
Command:
rpm -ivh jdk-8u131-linux-x64.rpm
Check to see if JDK was installed successfully
Command:
java -version
Check JDK installation path, (1 as the default path: / usr/java/jdk1. 8.0 _131)
Configure the JDK environment variable
1. Edit environment variables
export JAVA_HOME=/usr/java/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
2. Edit /etc/profile
Command:
vim /etc/profile
3. Environment configuration
Command: i goes into edit mode
Let me paste what I've edited up here
Enter the command: : wq!
Force save and exit
Put profile into effect immediately:
source /etc/profile
conclusion