1, first of all, the JDK under the CentOS environment configuration in two cases, has been the root user-level JDK configuration, the other is the other user group-level configuration. The root user-level configuration is explained here.
We have downloaded the directory to unzip the JDK. As follows
2, edit the environment variable configuration file:
Vi/etc/profile
Add the following code at the tail:
#JDK全局环境变量配置
Export java_home=/usr/local/java/jdk1.8.0_181
Export Classpath=$:classpath: $JAVA _home/lib/
Export path= $PATH: $JAVA _home/bin
Also modify the storage location of the JDK on the export java_home= own Linux . The other two lines do not need to be modified
3. Let the environment variable configuration take effect. Use the following command:source/etc/profile
4, use Java and Javac command to query whether the configuration is in effect.
When this happens, the environment variables are basically well configured.
Java
Javac
If you want to know how to configure the user level, you can refer to this document: 78486711?locationnum=9&fps=1
CentOS configuration environment Variables for JDK