Install JDK under Mac

Source: Internet
Author: User

Originating from http://blog.csdn.net/collonn/article/details/28483109:

Mac OS 10.9 installs jdk1.6.
The Java provided by Apple is installed in the/system/library/frameworks/javavm.framework/directory, so let's look at what's in this directory.
Let's see where Java is, run the following command
>>whereis Java
/usr/bin/java
>>ls-l/usr/bin/java
Lrwxr-xr-x 1 root Wheel 5 23:08/usr/bin/java-/system/library/frameworks/javavm.framework/versions/current /commands/java
See, this is a soft connection,/usr/bin/java actually point to the really entertaining file is the back of that Java file, OK, let's see what's in the directory where this Java file is
>>ls-l/system/library/frameworks/javavm.framework/versions/current/commands/
Drwxr-xr-x Root Wheel 1530 5 20 23:08.
Drwxr-xr-x 7 Root Wheel 238 5 20 23:08..
-rwxr-xr-x 1 root Wheel 54640 5 23:08 appletviewer
-rwxr-xr-x 1 root wheel 54624 5 23:08 Apt
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Extcheck
-rwxr-xr-x 1 root Wheel 54624 5 23:08 IDLJ
-rwxr-xr-x 1 root wheel 54624 5 23:08 jar
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Jarsigner
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Java
-rwxr-xr-x 1 root Wheel 68224 5 23:08 java_home
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Javac
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Javadoc
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Javah
-rwxr-xr-x 1 root Wheel 54624 5 23:08 JAVAP
-rwxr-xr-x 1 root Wheel 49584 5 23:08 javaws
-rwxr-xr-x 1 root Wheel 54624 5 23:08 jcmd
-rwxr-xr-x 1 root Wheel 54640 5 23:08 jconsole
-rwxr-xr-x 1 root Wheel 54624 5 23:08 jdb
-rwxr-xr-x 1 root Wheel 54624 5 23:08 jhat
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Jinfo
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Jmap
-rwxr-xr-x 1 root Wheel 54624 5 23:08 JMC
-rwxr-xr-x 1 root Wheel 54624 5 23:08 JPS
-rwxr-xr-x 1 root Wheel 54640 5 23:08 jrunscript
-rwxr-xr-x 1 root Wheel 54640 5 23:08 jsadebugd
-rwxr-xr-x 1 root Wheel 54624 5 23:08 jstack
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Jstat
-rwxr-xr-x 1 root Wheel 54624 5 23:08 jstatd
-rwxr-xr-x 1 root Wheel 54640 5 23:08 JVISUALVM
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Keytool
-rwxr-xr-x 1 root Wheel 54640 5 23:08 native2ascii
-rwxr-xr-x 1 root Wheel 54624 5 23:08 ORBD
-rwxr-xr-x 1 root Wheel 54640 5 23:08 pack200
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Policytool
-rwxr-xr-x 1 root Wheel 54624 5 23:08 rmic
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Rmid
-rwxr-xr-x 1 root Wheel 54640 5 23:08 rmiregistry
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Schemagen
-rwxr-xr-x 1 root Wheel 54640 5 23:08 serialver
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Servertool
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Tnameserv
-rwxr-xr-x 1 root Wheel 54640 5 23:08 unpack200
-rwxr-xr-x 1 root Wheel 54624 5 23:08 Wsgen
-rwxr-xr-x 1 root Wheel 54640 5 23:08 Wsimport
-rwxr-xr-x 1 root Wheel 54624 5 23:08 XJC
This directory is familiar, the original directory is what we usually say java_home/bin/

OK, let's go back and take a look at the outside directory.
>>cd/system/library/frameworks/javavm.framework
>>ls-l
Drwxr-xr-x Root Wheel 374 5 20 23:08.
Drwxr-xr-x 118 root Wheel 4012 2 18 13:50..
Lrwxr-xr-x 1 root Wheel 5 23:08 Classes-versions/currentjdk/classes
Lrwxr-xr-x 1 root Wheel 5 23:08 Commands-Versions/currentjdk/commands
Lrwxr-xr-x 1 root Wheel 5 23:08 frameworks-Versions/current/frameworks
Lrwxr-xr-x 1 root Wheel 5 23:08 Home-Versions/currentjdk/home
Lrwxr-xr-x 1 root Wheel 5 23:08 JAVAVM-VERSIONS/CURRENT/JAVAVM
Lrwxr-xr-x 1 root Wheel 5 23:08 Libraries-versions/currentjdk/libraries
Lrwxr-xr-x 1 root Wheel 5 23:08 Resources, versions/current/resources
Drwxr-xr-x Root Wheel 374 5 23:08 Versions
-rw-r--r--1 root Wheel 104 2 13:48 Module.map
See, almost all of the soft connections are pointing to subdirectories in the directory's versions directory, so let's go into the versions directory and see what's in this directory.
>>CD versions/
>>ls-l
Drwxr-xr-x Root Wheel 374 5 20 23:08.
Drwxr-xr-x Root Wheel 374 5 20 23:08..
Lrwxr-xr-x 1 root Wheel 5 23:08 1.4-CURRENTJDK
Lrwxr-xr-x 1 root Wheel 5 23:08 1.4.2-CURRENTJDK
Lrwxr-xr-x 1 root Wheel 5 23:08 1.5-CURRENTJDK
Lrwxr-xr-x 1 root Wheel 5 23:08 1.5.0-CURRENTJDK
Lrwxr-xr-x 1 root Wheel 5 23:08 1.6-CURRENTJDK
Lrwxr-xr-x 1 root Wheel 5 23:08 1.6.0-CURRENTJDK
Drwxr-xr-x 7 Root Wheel 238 5 23:08 A
Lrwxr-xr-x 1 root wheel 1 5 23:08
Lrwxr-xr-x 1 root Wheel 5 23:08 currentjdk/system/library/java/javavirtualmachines/1.6.0.jdk/contents
See, all Java versions point to the same directory currentjdk, and CURRENTJDK points to another directory, okay, let's see what's in this directory.
>>cd/system/library/java/javavirtualmachines/1.6.0.jdk/contents
>>ls-l
Drwxr-xr-x Root Wheel 340 10 11 2013.
Drwxr-xr-x 3 Root Wheel 102 10 11 2013..
Drwxr-xr-x Root Wheel 408 5 23:08 Classes
Drwxr-xr-x Root Wheel 1394 5 23:08 Commands
Drwxr-xr-x 6 Root Wheel 204 5 23:08 Home
-rw-r--r--1 root Wheel 1961 5 23:08 Info.plist
Drwxr-xr-x root Wheel 1700 5 23:08 Libraries
Drwxr-xr-x 3 Root Wheel 102 5 23:08 MacOS
Drwxr-xr-x Root Wheel 1088 5 23:08 Resources
-rw-r--r--1 root Wheel 462 5 23:08 version.plist
See the home directory, this directory is what we usually call the Java_home.

-Second, download a jdk1.7_xx.dmg from Oracle and follow the prompts to install it.
The Java provided by Oracle is installed in the/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.7.0_55.JDK directory.

--vim ~/.bash_profile, add the following code.
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

Install JDK under Mac (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.