Install jdk1.8 under Linux in three minutes

1. Install jdk

1.1 yum install 1.8.0 version openjdk

[root@localhost ~]# yum install java-1.8.0-openjdk* -y

After the execution, the installation will be performed automatically, and the installation is as follows:
Insert picture description here

1.2 View the jdk version number

Insert picture description here

1.3 View the installation path

Because the whole process is automatically installed, after installation, the default jre and jdk environment are in the /usr/lib/jvm path:
Insert picture description here

2. Environment configuration

2.1 Configure jdk environment

Change setting:

vi /etc/profile

Modify as follows:

export JAVA_HOME=/usr/lib/jvm/java

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

export PATH=$PATH:$JAVA_HOME/bin

Configuration takes effect:

. /etc/profile

As shown below:
Insert picture description here

2.2 View variables

Insert picture description here

2.3 Successful verification

Enter the commands javac and java, the configuration is successful as shown below:
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/u010312671/article/details/106781552