Install JDK under Linux (Xiaobai Tutorial)

1. Select and download jdk

1. Download the corresponding jdk on the official website according to your own system version, because my LINUX (testbest) is 32-bit, so I download the 32-bit jdk.

2. Official website download address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

3. Select the agreement as shown in the figure below and click to confirm.

 

 

2. Install jdk under Linux

JDK is generally installed in the /usr directory. Create a new folder to use as the Java installation directory.

[root@besttest ~]# cd /usr/ ----Enter the command and enter the usr directory

[root@besttest usr]# mkdir java ----Enter the command and create a new folder named java

[root@besttest usr]# cd java ---- Enter the java folder directory

 

 

3. Upload jdk and decompress it

I used Xshell 5 to upload

[root@besttest java]# rz ---- upload JDK file

[root@besttest java]# tar -zxvf [file name] ---- extract the JDK file

Here you can use Xftp 5 to upload directly.

 

4. Configuration file

 

[root@besttest java]# vi /etc/profile ---- edit file

Press the insert key and add the following at the bottom

export JAVA_HOME=/usr/java/ your version

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Press the ESC key, then enter: wq (colon wq) Enter, save and exit.

 

V. Completion and Inspection

[root@besttest java]# cd /etc ---- enter the etc directory

[root@besttest etc]# source profile ---- Effective configuration.

[root@besttest etc]# java -version ---- Check whether the installation is successful, and the output similar to the following figure shows that the installation is successful.

 

 

Guess you like

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