centos7 mounting JAVA (JDK 1.8), and configure the environment variables

First, select the version

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Select the appropriate version, where the election is (jdk-8u231-linux-x64.tar.gz ), click on the appropriate version of the need to log in to get the URL with AuthParam direct download will complain: 401 Authorization Required

Second, download & install

1. Download, pay attention to the following connection can not be used directly, for a link with a URL address on their own AuthParam

wget https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.tar.gz?AuthParam=1578585050_4746190b52bb966a279bc541d37f00de

2. Create a good java installation folder

mkdir /usr/local/java/

3. Extract the folder jdk to / usr / local / java / under

tar -zxvf jdk-8u231-linux-x64.tar.gz -C /usr/local/java/

4. Check folder and jdk version

cd /usr/local/java && ll

The setting environment variables, to facilitate instruction execution java

vim /etc/profile

Add the following to the end (Insert into edit mode, ESC to exit edit mode, enter: wq save)

export JAVA_HOME=/usr/local/java/jdk1.8.0_231
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

The environment variables to take effect

source /etc/profile

6. Check installed java version

java -version

Third, other

1. Find the installation path of java

whereis java

Guess you like

Origin www.cnblogs.com/nickchou/p/12174086.html