Configure Java RTE in CentOS
原创
4057次查看
本篇目录
Two ways to configure Java runtime environment in CentOS.
Update the software package
Make sure the server software package is updated.
sudo yum update -y
Method 1
Install OpenJRE.
sudo yum install java-1.8.0-openjdk -yCheck whether it is installed.
java -version
Method 2
Download JDK from Oracle website, and unzip it to /usr/local/java/jdk1.8.0_241. You need to sign up to download, and it is free.
Open the file.
vim /etc/profileAdd the code below to the end of the file.
export JAVA_HOME=/usr/local/java/jdk1.8.0_241
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
Make it work.
source /etc/profileAdd a soft link.
ln -s ${JAVA_HOME}/bin/java /usr/bin/java
Check whether it is installed.
java -version
国际版