1, JDK installation path:
View JDK path command: / usr / libexec / -V JAVA_HOME
default JDK1. 6 (comes with the Apple JDK) path: / System / Library / the Java / JavaVirtualMachines / 1.6 . 0 .jdk / Contents / Home
. The default JDK1 7 , 1.8 (the Oracle) Home:. / Library / the Java / JavaVirtualMachines / jdk1 8 .0_241.jdk / Contents / Home
2, the environment variable configuration
Create a configuration file:
$ Touch .bash_profile
open the configuration file:
$ Open -e .bash_profile
configuration files into content:
JAVA_HOME = / Library / the Java / JavaVirtualMachines / the JDK-11.jdk / Contents / Home
the PATH = $ JAVA_HOME / bin: $ the PATH :.
the CLASSPATH = $ JAVA_HOME / lib / tools.jar: $ JAVA_HOME / lib / dt.jar :.
Export JAVA_HOME
Export the PATH
Export the CLASSPATH
configuration files take effect:
$ Source .bash_profile
to see whether the configuration take effect:
$ echo $ JAVA_HOME
view JDK version information :
$ -version the Java
references: https: //www.jianshu.com/p/bd912e2d40f3