Configure Java RTE in CentOS
- 原创
 - 2020-06-19 11:12:27
 - Memory
 - 1014
 
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