Samuel Sjöberg's weblog

Skip to navigation

Java source files in OS X

I couldn't find any good information on this out there, so here's my short guide on how to attach the java source in Eclipse on OS X.

If you're a code-completion junkee like me you might have noticed that the Java distribution in OS X doesn't come with any source file attachment by default. You will need to get it and attach it yourself.

The first step is to go to Apple Developer Center and download the J2SE 5.0 Release 5 Developer Documentation (I haven't switched to Java 6 on the Mac yet). If you're not a ADC member you can become one on the fly (it is a free membership).

Once you've downloaded and installed the disc image with the documentation it only remains to point Eclipse to the right file. Launch Eclipse and open Preferences > Java > Installed JREs and then choose to edit the active JRE (OS X default JRE). In the dialog that appears, choose to attach source and point it to:


This will give you the source attachment for the sun classes, such as the JFC and Swing.

Reader comments

  1. Thanks a lot for this!

    You just saved my life :-)

    19th August 2007, 16:51 CET. 
  2. I am running Snow Leopard (OS X 10.6) on my Mac. When I went to the Apple Developer Connection today, the latest Java documentation image was for Leopard (OS X 10.5). Nonetheless, I downloaded it. However, it would not install: the installation package told me that it would only install on Leopard.

    11th September 2009, 19:11 CET. 

Pages linking to this entry

Pingback is enabled on all archived entries. Read more about pingback in the Pingback 1.0 Specification.

About this post

Created 7th March 2007 19:48 CET. Filed under Java, Mac OS X.

1 Pingback