1, View linux version
cat /proc/version
I have a 64-bit linux, so you need to download the 64-bit version of linux jdk
2, jdk download
download link:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Because you want to download the jdk8, so one needs to scroll down to find the location corresponding download
After accepting the agreement click download, you need to register an account to download.
3, the packet transmitted to install the downloaded server linux
New jdk directory under / usr / local directory
cd /usr/local
mkdir jdk
Enter the new jdk directory
cd jdk
Open transmission window, transmission installation package downloaded to the directory
rz
4, extracting archive
tar -zxvf jdk-8u11-linux-x64.tar.gz
View unzipped content:
5, configure the environment variables
vim /etc/profile
JAVA_HOME=/usr/local/jdk/jdk1.8.0_11
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME
export JRE_HOME
export PATH
export CLASSPATH
: Wq to save and exit behalf
6, executable file to validate the configuration
source /etc/profile
7, view the configuration is successful
java –version
8, if other jdk version installed before, here found Xin'an version does not take effect, re-execute the delete / etc after the java files in / usr / bin directory / profile file