has been using Windows development, is now a Mac development installation JDK configuration environment A little trouble, consulted a number of articles, found a simple record down.
1, open the Mac comes with terminal terminal;
2, enter the current user home directory, cd ~;(Default User directory is not required)
3, temporary authorization, sudo su;
4, enter the system password (lock password does not display input);
5. Create a. bash_profile file, touch. Bash_profile (if there is no need to create a new, you can directly verify the sixth step and then choose whether to perform this step);
6. Open the. bash_profile file, opening bash_profile (can open then new success);
7, Vim. Bash_profile Enter the command below the JDK, note that the value of Java_home is adjusted according to its own directory, I installed the JDK1.8:
Java_home=/library/java/javavirtualmachines/jdk1.8.0_65.jdk/contents/home
classpaht=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Path= $JAVA _home/bin: $PATH:
Export Java_home
Export CLASSPATH
Export PATH
Save and exit;
8. Read and execute the commands in the file: source. bash_profile;
9. Enter Java-version in terminal to display JDK information, then the configuration is successful.
MAC OX configuration JDK environment variable