linux jdk8 download and install configuration

Download jdk8

Here you can use Windows to download and then spread to the virtual machine

  1. Enter the jdk download page
    https://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Dropdown find JavaSE8, click on the download button at the right side of jdk
 
 
  1. Click consent agreement ○ Accept License Agreement
  2. Select the Linux jdk, here choose tar.gz way that the source installation
 
 
  1. Wait for the download to complete

jdk lead into the virtual machine

Here Xshell choose to use the tool Xftp

 
 
  1. First create a new folder, the directory is / usr / local / java
    mkdir /usr/local/java (目录随意)
    can also create a new folder in Xftp
  2. Locate the downloaded on the left side of the Windows directory jdk source package, double-click the incoming Linux / usr / local / java directory
 
 

jdk decompression

  1. Command line into the / usr / local / java folder
    cd /usr/local/java
  2. Decompression: tar zxvf archive name (for example: tar zxvf jdk-8u191-linux-x64.tar.gz) can enter a name following only tar zxvf j, and then auto-complete the Tab key file name
  3. Delete archive: rm -f archive name (for example rm -f jdk-8u191-linux-x64.tar.gz)

Environment variable configuration

  1. Edit / etc / profile file
    vi /etc/profile (root用户)
  2. Press Insertor the Ikey is switched to the edit mode.
    To find the end of the content, enter the following passage by picture.
    In unset ifront of input
export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
#(!!!注意:JAVA_HOME的路径是你实际解压后的JDK的路径,千万别写错了)
  1. According to Escexit edit mode, enter :wqto save and exit
     
     
  2. Environment variables to take effect
    for the / etc / profile after the completion of the preparation is not enough, you also need the final step is to let us modify the file just becomes effective together, so we enter a command for the changes to take effect.
    The entry into force command:source /etc/profile (root用户)

Verify that the installation was successful or not

Jdk installed user to log in again, execute the following command

java -version

 
 

 

Displays the version number is installed successfully



Author: moon ___
link: https: //www.jianshu.com/p/f000e05f3512
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Guess you like

Origin www.cnblogs.com/liuwei00125/p/12554063.html