Linux - build jdk environment

Title Linux - Build jdk environment

Linux builds jdk, the case uses jdk8

1. Check linux bitness (64 and 32 bit)

[root@node1 /]# getconf LONG_BIT
64

2. Download the corresponding linux JDK package, here use jdk8

Download jdk8: link: https://www.oracle.com/java/technologies/downloads/#java8
insert image description here

3. Upload jdk-8u371-linux-x64.tar.gz to linux

Put the downloaded jdk in the usr/java directory and create a jdk8 installation directory

[root@node1 /]# mkdir -p /usr/java/jdk8
[root@node1 usr]# cd /usr/java
[root@node1 java]# ls
jdk8  jdk-8u371-linux-x64.tar.gz

4. Unzip the installation package to the jdk8 folder

[root@node1 /]# cd /usr/java/jdk8
[root@node1 jdk8]# tar -zxvf ../jdk-8u371-linux-x64.tar.gz ../jdk8/
[root@node1 jdk8]# ls
jdk1.8.0_371

After successful decompression, a folder jdk1.8.0_371 is obtained

5. Edit the configuration file and configure environment variables

[root@node1 jdk8] vim /etc/profile

Add the following on the last line

export JAVA_HOME=/usr/java/jdk8/jdk1.8.0_371
(此处为安装jdk的目录,需改成各自真实的安装路径)

export PATH=$PATH:$JAVA_HOME/bin

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

6. Refresh the configuration file and verify success

[root@node1 jdk8] source /etc/profile
[root@node1 jdk1.8.0_371]# java -version
java version "1.8.0_371"
Java(TM) SE Runtime Environment (build 1.8.0_371-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)

OK, jdk has been installed successfully! !

----Editor: Edge of Dreams

Guess you like

Origin blog.csdn.net/gsycwh/article/details/131457979