Java / Eclipse on MacOSX: where is src.zip?

With the latest Java update on MacOSX 10.6, Eclipse no longer finds Java sources.

I’m not quite sure (for example, I don’t remember) if I downloaded the source manually in the past and put them somewhere, or if MacOSX provided them, and Eclipse found them automatically.

Does MacOSX have sources? (Please, no assumptions here. I really want to know this.)

If not, where can I get them?

+46
java eclipse macos
Oct 24 '10 at 23:26
source share
12 answers

After installing the latest Java update, you will find src.jar under

/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home

This is where I pointed out "JRE home" for Java 1.6 in Eclipse to. Everything works as expected (still :)

+30
Oct. 25 2018-10-25
source share

As I understand it, on β€œJava for Mac OS X 10.6 Update 3” there are 3 places where you will find Java installed on MacOS.

  • /System/Library/Frameworks/JavaVM.framework/was an old place.
  • / System / Library / Java / JavaVirtualMachines / - a new standard place - there you will find a new version.
  • / Library / Java / JavaVirtualMachines is for "... previewing the developer and third-party JVMs"

Pay attention to the MacOS rule for placing standard Apple components in / System / Library and local extensions in / Library

The default JDK now does not have src.jar (although it is a JDK, therefore it has javac, etc.). But if you install Java Developer from Apple , you will get

/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk

which has src.jar in the Contents / Home section

So, I think the smart thing is to install the developer package and point to it from your IDE.




Update - for "Java for Mac OS X 10.7 Update 1", by installing the developer package, the source can be found in

/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/src.jar

+42
Nov 16 '10 at 11:54
source share

This is my experience with src.jar !.

  • As mentioned earlier, you will have to sign up for an Apple developer (for free)

  • go to Download for Apple Developers , and then search for java.

  • I chose "Java for OS X 2013-005 Developer Package"
  • After downloading and installing the package, you will find src.jar in / Library / Java / JavaVirtualMachines / 1.6.0_65-b14-462.jdk / Contents / Home /

    Hope this helps!

+7
Sep 22 2018-11-21T00
source share

In the latest version of OSX 10.6.7 (java 1.6.0_24), they cleared all of these directories ... no src.jar does not exist, and most of the specified directories are missing.

annoying to the end ...

+4
Jun 17 2018-11-11T00:
source share

as of today, 6/1/12, the Java Devloper package for OSX 10.7 is no longer shipped with src.jar in the Home directory. Some Google results indicate Apple's decision in 2010 to abandon Java support in OSX (ported by Apple). And Oracle has begun providing the Mac OS X JDK since April this year. So go ahead, install the JDK from Oracle.

+3
Jun 01 '12 at 16:40
source share

With Oracle Java SE 7 for Mac OS X x64, src.zip ends at the following location, in this case the specific version is Java SE 7u10

 /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/src.zip 
+3
Dec 20 '12 at 19:26
source share

On Mac OS X 10.5.8, after upgrading to Java 1.6.0_22 and installing the latest developer update on October 20, 2010, src.jar for Java 6 does not exist.

 $ find / System / Library / Java / System / Library / Frameworks -name src.jar
 /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/src.jar
 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/src.jar

Switching to the source in NetBeans 6.9.1 says compiled code for all constructors and methods, for example. java.awt.Point :

 public Point() { //compiled code throw new RuntimeException("Compiled Code"); } 

Perhaps you can extract a useful JAR from a previous update, as suggested in this thread .

Appendix: in NetBeans, the default platform location is an attribute in the file ~/.netbeans/6.9/config/Services/Platforms/org-netbeans-api-java-Platform/default_platform.xml :

 <sources> <resource>jar:file:/Library/Java/JavaVirtualMachines/ 1.6.0_22-b04-307.jdk/Contents/Home/src.jar!/src/ </resource> </sources> 

Alternatively, you can specify the file /Library/Java/Home/src.jar :

 <sources> <resource>jar:file:/Library/Java/Home/src.jar!/src/</resource> </sources> 
+2
Oct 25 '10 at 3:11
source share

Perhaps this explains this :?

Starting with the release of Java for Mac OS X 10.6 Update 3, the Java runtime ported by Apple and shipped with Mac OS X is deprecated. Developers should not rely on the Apple-supplied version of Java to be present in future versions of Mac OS X Java for Mac OS X 10.6 Update 3 and 10.5 Update 8 Release Notes

+1
Nov 15 '10 at 20:51
source share

If you want Eclipse to always point to the current JDK by default, and its sources point to this:

 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 

Eclipse will then resolve the currentJDK symlink and point it to the current JDK.

+1
Apr 24 '11 at 17:00
source share

Call me old fashioned, but:

find / Library / Java / JavaVirtualMachines / -name src.jar

worked for me :-)

+1
Aug 07 '14 at 13:15
source share

Thanks to the people who previously provided answers; they were helpful.

Like newb for Mac (10.6.6), here is what I did for MyEclipse, which should also work for Eclipse; I have not tested this in disconnected mode. When you try to add another JRE for MyEclipse 8.5, you need a "Mac OS X VM" and will not support a "standard virtual machine". I tried changing the eclipse.ini and myeclipse.ini files, and also tried to run MyEclipse from the command line with a specific set of JAVA_HOME without any changes.

1) download and install the correct Java Developer package. Go to System Settings β†’ Software Update β†’ Installed Software. You can have several versions of this installation, in my case I had both β€œJava for Mac OS X 10.6 Update 2” and β€œJava for Mac OS X 10.6 Update 3” - so be sure to sort by name or check some other path . To date, the downloaded file name was javadeveloper_10.6_10m3261.dmg.

2) In the terminal window, I added some symbolic links from the OS virtual machine that point to banks in a standard virtual machine. I have slightly modified security permissions, so you may or may not need to use sudo to create symbolic links.

 cd /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/appledocs.jar sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/docs.jar sudo ln -s /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar 
0
Jan 16 '11 at 17:42
source share

If nothing works, just download the sources from http://jdk7src.sourceforge.net/ here and add them. worked for me.

0
Feb 08 '15 at 3:27
source share



All Articles