No Java source on Mac OS X

I think my JDK is broken. I am on OS X 10.6.8.

I want to look in the sources when debugging in Eclipse, etc., but Eclipse cannot find the sources, so I looked at the installed JREs and found this path with the header JVM 1.6.0 (MacOS X Default)

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

In the terminal, I went to the directory /System/Library/Frameworks/JavaVM.framework/Versionsand did ls -al:

drwxr-xr-x  13 root  wheel  442  8 Sep 22:46 .
drwxr-xr-x  12 root  wheel  408  8 Sep 22:46 ..
lrwxr-xr-x   1 root  wheel    5  8 Sep 22:45 1.3 -> 1.3.1
drwxr-xr-x   3 root  wheel  102 21 Jul  2009 1.3.1
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.4 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.4.2 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.5 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.5.0 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.6 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10  8 Sep 22:45 1.6.0 -> CurrentJDK
drwxr-xr-x  10 root  wheel  340  8 Sep 22:46 A
lrwxr-xr-x   1 root  wheel    1  8 Sep 22:45 Current -> A
lrwxr-xr-x   1 root  wheel   59  8 Sep 22:45 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

So, Eclipse already has a corresponding JDK. Another test:

$ javac -version
javac 1.6.0_26

$ which javac
/usr/bin/javac

$ ls -al /usr/bin/ | grep javac
lrwxr-xr-x     1 root   wheel          75  8 Sep 22:45 javac -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac

So everything looks great, but no rt.jar or src.jar. Here is a screenshot:

A screenshot showing the jars in the current JDK.

Therefore, I am trying to reinstall it. I turn to the Apple website and load the package: Java for Mac OS X 10.6 Update 5 Developer Packagefile: javadeveloper_for_mac_os_x_10.6__10m3425.dmg. Installation completed successfully, but does not change anything.

I show the latest modified files on my computer, these are just some java tools located in usr/share/java/Tools

  • Java VisualVM
  • Jar bundler
  • -

java rt.jar src.jar.

+5
3

. Apple Java 6. Oracle Java JDK, src.zip.


Java . , ADC.

, Eclipse src.zip, .

10.7 src.zip /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home/src.jar

+6

: http://lookfirst.com/2011/03/fix-missing-source-for-java-mac-os-x.html ( #s )

  • http://connect.apple.com Mac OS X 10.6 Update 4
  • .
  • Terminal.app
  • cd/System/Library/Frameworks/JavaVM.framework/Home
  • sudo ln -s/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/src.jar.
  • sudo ln -s/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/docs.jar.
+3

, , , , .

Eclipse ( 1.6): jdk1.7.0_21_src_for_mac.zip

0

All Articles