Installation of JDK1.8 for Linux

This is the most basic, but it is always checked and checked.

First, Download jdk8

Address: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Two. Log on to Linux and switch to root users.

[cjh@localhost ~]$ su root

Password:

Three, set up Java installation directory in usr directory.

[root@localhost local]# cd /usr/local

[root@localhost local]# mkdir java

Four, cut the compressed packet to the Java directory and decompress it.

mv jdk-8u162-linux-x64.tar.gz java

tar -zxvf jdk-8u162-linux-x64.tar.gz

Get a folder jdk1.8.0_162

Five, edit configuration files, configure environment variables

vi /etc/profileAfter entering the letter A or I, you can enter the edit state and add the following variables into the file.

JAVA_HOME=/usr/local/java/jdk1.8.0_162

CLASSPATH=$JAVA_HOME/lib/

PATH=$PATH:$JAVA_HOME/bin

export PATH JAVA_HOME CLASSPATH

Finally, don’t forget to save and press ESC-> input: WQ (save and exit).

Note: (1) under Windows; number Linux is: (2) Linux under Windows is /

Six. Restart the machine or execute the command.

source /etc/profile

Seven. Check installation status.

[root@localhost java]# java -version

Leave a Reply

Your email address will not be published. Required fields are marked *