Install jdk under CentOS7 and configure environment variables

Step 1: Here I downloaded jdk-7u79-linux-x64.tar.gz, the download address is:


http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Step 2: Create a new jdk installation directory, I created a new Java directory under /usr/local/, command: mkdir /usr/local/java

Step 3: Upload the downloaded tar.gz file through the SSH tool Go to the /usr/local/java directory Step

4  tar.gz file

tar xvf jdk-7u79-linux-x64.tar.gz 

Step 5: cd /etc directory, modify the profile file, and in the configuration file At the end add


export JAVA_HOME=/usr/local/java/jdk1.7.0_79 
export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre 
export PATH=$PATH:/usr/local/java/jdk1.7.0_79 /bin 
export CLASSPATH=./:/usr/local/java/jdk1.7.0_79/lib:/usr/local/java/jdk1.7.0_79/jre/lib


Step 6: reboot the system Step

7 : java javac java -version to see if it is configured properly.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262886&siteId=291194637