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:
1.2 View the jdk version number
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:
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:
2.2 View variables
2.3 Successful verification
Enter the commands javac and java, the configuration is successful as shown below: