A lot of people are asking, after downloading Oracle's JDK, environment variables don't know how to set up, so today we have an article about how JDK sets environment variables in Mac system.
IDK in the Mac system, there are actually two paths, one is the default, one is downloaded JDK, need to be updated.
The default is very easy to find. Enter Whereis Java in the terminal to see the path, use the ls-l to see the real path
? / Whereis java
/usr/bin/java
? / ls-l/usr/bin/java
/usr/bin/java-/system/library/frameworks/javavm.framework/versions/current/commands/java
? /
If you downloaded the idk from Oracle and want to update it, you first need to modify the JDK's environment variables. Oracle is downloaded by default and is installed in the
In/library/java/javavirtualmachines/
So, first we need to make a change to the Etc/profile file.
Enter shoo su[Temporary authorization]
Vi/etc/profile (enter config file)
Copy the following code into the file, and the JDK version changes according to your own download
Java_home=/library/java/javavirtualmachines/jdk1.7.0_55.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
After the copy is complete, save exit
Last file update: Source/etc/profile
Enter the Echo $JAVA _home. The address that you just updated appears, indicating that the modification was successful.
from:http://blog.csdn.net/fengmoon/article/details/52106694
JDK in MAC system environment variable set (GO)