1. Version
MAC OS 10.10.3
Jdk:jdk1.8.0_40
JDK download for Mac version: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Unzip the JDK package to a path
/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home
3. Configure Environment variables
Open the user-level system environment variable profile open ~/.bash_profile (zsh open ~/.ZSHRC file is installed)
Adding configuration parameters
Export java_home= '/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home '
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
4. Verifying the installation results
Reboot to ensure system configuration file re-read takes effect
Terminal input: Java-version
The following information is displayed to indicate that the JDK was successfully installed:
Java Version "1.8.0_40"
Java (TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot (TM) 64-bit Server VM (build 25.40-b25, Mixed mode)
5.QA: Why configure the system's environment variables?
When using some Java commands, such as Java Javac, and so on, the local (none of the Shell's own commands) is not found, this time need to go to the declaration of the directory to find, that is, the environment variable $path the specified directory.
Therefore, for some things that need to use the command line, you need to configure environment variables, such as Mysql,maven
JDK installation method under Mac environment