The method of mounting the java linux installation step Linux environment java

linux installation step java

Method 1: yum install download

1. Find a list of related java

yum -y list java*

or

yum search jdk

2, install jdk

yum install java-1.8.0-openjdk.x86_64

3, after installation verification

java -version

4, the default path is installed via yum: / usr / lib / JVM

5, will be added to the installation path jdk JAVA_HOME

vi /etc/profile

In the final document added:

#set java environment
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH

After modifying / etc / profile allowed to take effect

. / Etc / Profile  (Note  After a space is required)

Second way, the official website to download jdk, ftp server upload extracting installer

1, into the  Oracle official website  to download the appropriate JDK version, ready to install.
Note: This need to download the Linux version. Here to jdk-8u151-linux-x64.tar.gz example, you download the file may not be this version, it does not matter, as long as the suffix (.tar.gz) can be consistent.

2, create a directory

In /usr/Creating directory javadirectory,

mkdir /usr/local/java
cd /usr/local/java

The downloaded file jdk-8u151-linux-x64.tar.gz placed under / usr / local / java / directory.

3. Extract JDK

tar -zxvf jdk-8u151-linux-x64.tar.gz

4. Set Environment Variables

Modify  vi / etc / profile

Add the following in the profile file and save it:

set java environment
JAVA_HOME=/usr/local/java/jdk1.8.0_151 JRE_HOME=/usr/local/java/jdk1.8.0_151/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH

 

Note: where JAVA_HOME, JRE_HOME please according to their actual installation path and version of the JDK configuration.

Changes to take effect:

source /etc/profile

5. Test

java -version

Java show version information, then the JDK installation is successful

Method 1: yum install download

1. Find a list of related java

yum -y list java*

or

yum search jdk

2, install jdk

yum install java-1.8.0-openjdk.x86_64

3, after installation verification

java -version

4, the default path is installed via yum: / usr / lib / JVM

5, will be added to the installation path jdk JAVA_HOME

vi /etc/profile

In the final document added:

#set java environment
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH

After modifying / etc / profile allowed to take effect

. / Etc / Profile  (Note  After a space is required)

Second way, the official website to download jdk, ftp server upload extracting installer

1, into the  Oracle official website  to download the appropriate JDK version, ready to install.
Note: This need to download the Linux version. Here to jdk-8u151-linux-x64.tar.gz example, you download the file may not be this version, it does not matter, as long as the suffix (.tar.gz) can be consistent.

2, create a directory

In /usr/Creating directory javadirectory,

mkdir /usr/local/java
cd /usr/local/java

The downloaded file jdk-8u151-linux-x64.tar.gz placed under / usr / local / java / directory.

3. Extract JDK

tar -zxvf jdk-8u151-linux-x64.tar.gz

4. Set Environment Variables

Modify  vi / etc / profile

Add the following in the profile file and save it:

set java environment
JAVA_HOME=/usr/local/java/jdk1.8.0_151 JRE_HOME=/usr/local/java/jdk1.8.0_151/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH

 

Note: where JAVA_HOME, JRE_HOME please according to their actual installation path and version of the JDK configuration.

Changes to take effect:

source /etc/profile

5. Test

java -version

Java show version information, then the JDK installation is successful

Guess you like

Origin www.cnblogs.com/mo-nian/p/12510162.html