1. Unzip the jdk installation package:
attach the download address of jdk1.8:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
This method is to download jdk in advance installation package, the general format under Linux is *.tar.gz. Then decompress it directly, and configure the environment variables after the decompression is complete.
1. Create a java folder under /usr/local/
cd /usr/local/ 进入目录
mkdir java 新建java目录
2. After the folder is created, copy the installation package to the Java directory, and then unzip the jdk to the current directory
cp /usr/jdk-8u60-linux-x64.tar.gz /usr/local/java/ **注意文件名** 拷贝到java目录
tar -zxvf jdk-8u60-linux-x64.tar.gz 解压到当前目录(Java目录)
或者tar -zxvf jdk-8u60-linux-x64.tar.gz /usr/local/jdk1.8 解压到指定目录(jdk1.8目录)
3. After decompression, a jdk1.8.0_60 directory will appear in the Java directory, and the decompression is complete. Then configure the environment variables.
Edit the profile file under /etc/ and configure environment variables
vi /etc/profile 进入profile文件的编辑模式
在最后边追加一下内容(**配置的时候一定要根据自己的目录情况而定哦!**)
JAVA_HOME=/usr/local/java/jdk1.8.0_60
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
After saving and exiting the file, enter Java and Java -version in the console to see if there is any information output, as follows:
Java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
If the above information can be displayed, it means that the jdk installation is successful!
Note : After changing the environment variables, execute source /etc/profile
source: