Briefly
1. Mac OS (version 10.8) comes with jdk1.6 or JAVA6, but no source code. Mac OS comes with Java 6 which is released and updated by Apple, slightly different from Oracle's Java 6, such as No Rt.jar, instead of Classes.jar other details for reference http://my.oschina.net/hmj/ blog/79939
2. Oracle officially does not provide Java 6 for Mac OS use, but Java 7 and source code can be downloaded from Orace official website, Oracle provides detailed installation guide, this article does not introduce. See Http://www.java.com/zh_CN/download/help/mac_install.xml
3. Mac OS Java 6 and Java 7 can coexist, this I did not test, do not introduce, online a lot of posts
4. Describes where to download Java 6 source code and resolve the problem that eclipse cannot find the source code the JAR File/system/.../classes.jar has no sourece attachment.
Detailed content 1. How do I query the Java version of this machine?
Open Terminal, enter Java-version
yangdemacbook-air:~ feiniao$ java-version
Java Version "1.6.0_51"
Java (TM) SE Runtime Environment (build 1.6.0_51-b11-457-11m4509)
Java HotSpot (TM) 64-bit Server VM (build 20.51-b01-457, Mixed mode)
2. Where is the Java Control Panel on your Mac?
Please note that only Java 7 with Oracle installed will have a control panel, detailed in Orace's official website.
Click the Apple icon in the upper-left corner of the screen.
Go to System Preferences
Click the Java icon to access the Java Control Panel.
3. Solve the problem that eclipse cannot find the source code the JAR File/system/.../classes.jar has no sourece attachment.
Cause Analysis:
The JDK that comes with the system does not have a source package and needs to be downloaded from the Apple official website
Here's how to fix it:
3.1 Downloads Java Development Kit with source code
There are many other things in the Https://developer.apple.com/downloads/index.action development package below that are not covered here.
Sign in with your Apple ID, and the first sign-in is a hint to register, all the way down the line. To this page
Now the latest version of the development package is as follows: Java for OS X 2013-004 Developer packages, after download normal installation
Online to see a lot of blog introduction is to go to http://connect.apple.com download, but this address can not open, is estimated to be the previous download link, has expired.
3.2 Installation and configuration
Refer to the blog http://www.blogjava.net/lsbwahaha/archive/2012/10/16/389692.html perform the following steps
1.sudo-s
2.cd/system/library/frameworks/javavm.framework/home
3.ln-s/library/java/javavirtualmachines/1.6.0_35-b10-428.jdk/contents/home/docs.jar.
4.ln-s/library/java/javavirtualmachines/1.6.0_35-b10-428.jdk/contents/home/src.jar.
5. Finally, similar to Windows, use Command + click in Eclipse to view the source of a class. Then choose "Add Source" and select the Src.jar file above to
Note that the above version number should be modified according to the software version number on your machine. Actually press TAB to get out.
I succeeded in following this operation, but the above commands 3 and 4 do not think it is possible to do so, the source code interface added by eclipse, directly found to perform the soft connection of the original files can also, because these files all users have Read permissions.
This might be the case for putting the source code into the Java directory of the Mac OS itself.
Other than that
Run at terminal type Java can see Java is located in/usr/bin/java, is a soft connection
Java-/system/library/frameworks/javavm.framework/versions/current/commands/java
Settings for 3.3 java_home
Refer to this blog http://kennylee26.iteye.com/blog/1772638
4. Modify the source code that is bound in eclipse
If the Java version of the system and the source code are updated, at this time need to rebind the new version of the source code, how to do?
There is a similar scenario, when assigning source code to Android.jar, it is possible to choose the wrong API version of the source code, how to modify?
The method is as follows, attaching a piece, the steps are roughly as follows:
Open the Build Patch,libraries tab, find the Classes.jar, select it, and click Edit on the right to configure the page.
The Java API's source code cannot be viewed in eclipse