Three methods of mounting centos jdk1.8

A manually extract the installation package:

1, the new java folder in the user directory:

  1.  
    # cd /usr/
  2.  
    # mkdir java
  3.  
    # Cd java

2. Download jdk1.8, enter http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html , copy the download directory

# wget http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz?AuthParam=1534129356_6b3ac55c6a38ba5a54c912855deb6a22

3, extract: tar -zxvf use to decompress the file name.

After unzipping:

4, configure the environment variables:

# vi /etc/profile

Add the following to the configuration file, then save and exit.

  1.  
    #java
  2.  
    export JAVA_HOME=/usr/java/jdk1.8.0_181
  3.  
    export PATH=$JAVA_HOME/bin:$PATH
  4.  
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib

5. Verification:

 

Two, yum install:

1, the search jdk installation package

# yum search java|grep jdk

2, download jdk1.8, after the default download directory: / usr / lib / jvm /

# yum install java-1.8.0-openjdk

3, and verify the installation configuration environment variable.

Third, use rpm installation:

1, download the installation package rpm:

# wget http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm?AuthParam=1534132498_e541d098d71f6243516fa69cd17eba60

2, using the rpm command to install:

# rpm -ivh jdk-8u181-linux-x64.rpm?AuthParam=1534132498_e541d098d71f6243516fa69cd17eba60

3, configure the environment variables, verify the installation.

Guess you like

Origin www.cnblogs.com/telwanggs/p/11546751.html