1. Install JDK1.6
Www.2cto.com
The oracle official website has a Mac installation package starting from jdk1.7, but some projects must use jdk1.6, so jdk1.6 must be installed through other channels.
Check the discovery, to install JDK 1.6, you can install the java support package provided directly from the apple developer website, the specific http://connect.apple.com/
For details, refer to this article
Http://stackoverflow.com/questions/6614380/jdk-on-osx-10-7-lion
2. Package path and other issues
JRE path installed by default
/System/Library/Frameworks/JavaVM. framework/
JDK packages installed on oracle, apple, and other devices are available at www.2cto.com.
/Library/Java/JavaVirtualMachines/
3. Where is JAVA_HOME?
/Library/Java/JavaVirtualMachines/1.6.0 _ 38-b04-436.jdk/Contents/Home
Note: The name of the 1.6.0 _ 38-b04-436.jdk directory is related to the installed jdk version.
4. Where Are rt. jar and jsse. jar?
Rt. jar has been integrated into/Library/Java/JavaVirtualMachines/1.6.0 _ 38-b04-436.jdk/Contents/Classes/classes. jar
Jsse. jar is also in the Classes directory
We recommend that you set classes. jar and jsse. jar to create a soft connection to/Library/Java/JavaVirtualMachines/1.6.0 _ 38-b04-436.jdk/Contents/Home/lib/, and classes. the soft connection of jar is named rt. jar
In this way, you can avoid the problem that rt. jar cannot be found, for example, when obfuscation codes are used. Www.2cto.com 5. Configure the environment variable file of JAVA_HOMEMac OS X in/etc/profile, which is always an important file of unix. Add the Xml Code JAVA_HOME =/Library/Java/JavaVirtualMachines/1.6.0 _ 38-b04-436.jdk/Contents/Home/export JAVA_HOME at the bottom, save the code, and log out. Note: After JAVA_HOME is added, the system will also use the jdk of JAVA_HOME you configured as the default JDK.