Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

With the latest Java update on MacOSX 10.6, Eclipse does not find the Java sources anymore.

I am not exactly sure (i.e. don't remember anymore) if I have downloaded the sources manually in the past and put them somewhere or if MacOSX provided them and Eclipse found them automatically.

Does MacOSX have the sources somewhere? (Please no assumptions here. I really want to know that.)

If not, where can I get them?

like image 375
Albert Avatar asked Oct 24 '10 23:10

Albert


People also ask

How do I find my JDK path on Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10.

How do I know if Java is installed on my Mac?

Mac OS X 10.7. 3 and above: Under System Preferences click on the Java icon to access the Java Control Panel which will list your Java version. If you do not see a Java icon under System Preferences, Java 7 or later versions is not installed.


1 Answers

As I understand it, as of "Java for Mac OS X 10.6 Update 3", there are 3 places you will find Java installed on MacOS.

  • /System/Library/Frameworks/JavaVM.framework/ was the old place.
  • /System/Library/Java/JavaVirtualMachines/ is the new standard place - there you will find the new release.
  • /Library/Java/JavaVirtualMachines is for '...developer previews, and 3rd party JVMs'

Note the MacOS rule of putting Apple-supplied standard components in /System/Library and local extensions into /Library

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

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

which has src.jar under Contents/Home

So I think that the sane thing to do is install the developer package and point to it from your IDE.


Update - for "Java for Mac OS X 10.7 Update 1", having installed the developer package the source can be found at

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

like image 86
Duncan McGregor Avatar answered Oct 11 '22 06:10

Duncan McGregor