Java Source Attacher

Add this URL to your Eclipse Installation to reach this solution's update site.

Oxygen (4.7)
Neon (4.6)
Mars (4.5)
Luna (4.4)
Kepler (4.3)
Juno (4.2, 3.8)
Previous to Juno (<=4.1)
Photon (4.8)

Learn more...

Details Group Tabs

Saturday, August 18, 2018 - 03:30
deador's picture

Please, add simple configuration of sources download path. Alternative offline source paths config would be nice too (or check for existing sources in ".sourceattacher" folder before downloading at least)
Thank you!

mmisingnamerxl's picture

The latest version 1.2.8 will check for local cached source files before trying to download from Internet.
Note: You will find new *.meta files in the ".sourceattacher" folder containing meta data to support this feature.
Adding preferences to configure plugin's cache folder would take time and cannot be implemented at the moment.
Thanks for support.

trodriguezw77's picture

When I select Attach Java Source for rt.jar in a JDK the plugin doesn't appear to do anything. If I select another jar from that JDK like zipfs.jar I can see it go to work downloading the source in the error log. I can then use that same zip file for the rt.jar sources. I would be nice if it worked correctly for rt.jar. Nice plugin otherwise though!

mmisingnamerxl's picture

Maybe the rt.jar already has some source code (i.e. attached (so the plugin didn't do anything) or the plugin is still in progress to download the source code from Internet (you would have to wait until the background job "Attaching source to library..." disappears from Eclipse status bar). I've just removed from my rt.jar (jdk version 1.8.0_66) and tried the plugin and it did work for me.

kverna's picture

I tried to install this plugin from all the URL mentioned but no where it is available.
Please provide the correct URL for installing this useful plugin.

mmisingnamerxl's picture

Thanks for the info. I didn't know that that hosting site was retired. I've just uploaded files to Bintray and updated the URL. Please try again.

tresheim's picture

I just discovered this plug-in in need for source code on a project where I don't control the target platform. This is really a life saver. However I wonder whether or not it is actually using the "Eclipse-SourceReferences:" attribute in MANIFEST.MF when it comes to Eclipse plug-ins. It does not appear so, but it should.

mmisingnamerxl's picture

Thanks for the idea. Currently it doesn't check for Eclipse-SourceReferences in MANIFEST.MF, I will think about implementing it when I have some time.

mmisingnamerxl's picture

Implemented Eclipse-SourceReferences support in 1.2.7

mmisingnamebec's picture

Where can I report bugs? There is no such feature here, is it?

The Source Attacher plugin doesn't work for me, but keeps hanging. The progress bar stays active forever.

I debugged the problem to the "WebBasedArtifactorySourceCodeFinder....js" file: The assignment of values to the input forms doesn't work.
Since the assignment doesn't work, the script keeps looping forever in the "sleep while loop".

I adapted the script as the following:
ie.document.getElementsByName('groupIdField').item(0).value = groupId
ie.document.getElementsByName('artifactIdField').item(0).value = artifactId
ie.document.getElementsByName('versionField').item(0).value = version
ie.document.getElementsByName('classifierField').item(0).value = 'sources'

It would be great if the JavaScript could be adapted!

mmisingnamerxl's picture

I have updated the JS code as you suggested and verified that it is working good now. Thank you for contribution. NOTE: I used the same plugin version so you will see the changes when you installing in a new Eclipse

mmisingnamebec's picture

I have to add, that I tried to download sources for my commons-logging-1.2.jar.
The website in question was:

Even when I fixed the script and executed it, I saw that the search yields to two results: sources.jar and test-sources.jar.
And I saw, that the latter one is chosen and returned by the script. This doesn't seem to be correct?!

mmisingnamerxl's picture

Thank you for finding this issue. It is also fixed.

gcardoso's picture

Is there any way to change where the sources are saved?
By default it's saved on C:\Users\xxxxxx\.sourceattacher but I wanted to save them inside the project so that I could share them with the rest of my team.

mmahlzahn's picture

I tried attaching the sources of SWT and the JDT but neither of them works.
I am using Luna on Linux.

mmisingnamerxl's picture

Some of the sites I used for search Eclipse plugin source code were not working. I have fixed by using some new sites. I tested with latest Eclipse (Luna) and verified that it can find the source code for plugins correctly. But one issue is the attached source jar will be lost the next time Eclipse is started so you will have to re-attach source again. Sorry about this issue but I don't see it will be fixed soon.

dclemensoab's picture

I just installed this plugin in a Kepler Eclipse and asked it to attach the source for one of the core Eclipse plugins so that I could see how it worked. Plugin sources no longer seem to be included in Eclipse releases, and I had been very frustrated trying to find them. But this Attacher found them automatically, downloaded and attached them in a few minutes.

Worked like a charm. I can't speak for other Open Source jars, but for Eclipse plugin sources, it was exactly what I needed.

jkempe's picture

It didnt work for me when I tried to attach gson-2.2.4-sources.jar to gson-2.2.4.jar
No error message, nothing happened.

mmisingnamerxl's picture

I tested with Eclipse 3.8 and your specified jar file at and it worked correctly for me.'s picture

Thank you for this lovely tool! However, the option to 'Attach Java source' is grayed out for libraries that are in a different folder like say src/webroot/web-inf/lib. Also this option is grayed out when I try accessing it from the Navigator view, it's available in the Project Explorer view though. It would be nice if it can be activated for arbitrary libraries and in Navigator.

mmisingnamerxl's picture

You must have the jar in the Build path of project first, the plugin cannot attach source code for any jar files not in project's Build Path.

peldritch's picture

You say in the description :

Note for Android developers:
- When programming Android projects using Google ADT plugin, the jar files inside libs folder will be added as libraries automatically but Eclipse will not allow change source code path for these libraries. This plugin can attach source code for Android libraries and will help Android developers in coding / debugging.

Now I installed your pluggin (kepler eclipse release) but I find no way of attaching the source - can I provide a file/folder URL to the my library project in the workspace ?

Please help, if this really solved the (very annoying issue) with ADT I will be sure to advertise !

Eclipse Java EE IDE for Web Developers.
Version: Kepler Release
Build id: 20130614-0229

mmisingnamerxl's picture

In Package Explorer view, expand "Referenced Libraries" of your Java project, right click on your jar file(s), choose the menu "Attach java Source". That's it.

sranger's picture

I tried installing it to the developer preview 4.3 M6 and it made all right-clicking stop working. I didn't receive any exception.

mmisingnamerxl's picture

Tested today with Eclipse SDK Kepler (version 4.3). It works correctly.

jbentley35i's picture

Is there a way to correct the database when it attaches the wrong source jar? The plugin keeps trying to attach the jcommander source to the testng library.

mmisingnamerxl's picture

Sorry but there is no way to remove wrong links, could you give me the name+version or the md5 of the jar file? I will search and remove it from database

sanajwala's picture

where does this copy the source jar that it downloads?

mmisingnamerxl's picture

Source code location for the plugin is /.sourceattacher/

emisingnameg38's picture

i tried axis.jar and commons-beanutils.jar with eclipe 3.6
I select the "Attach source file" option, and after doing this, I click on a class file but eclipse says "source not found"

mmisingnamerxl's picture

There are some libraries which are not easy to find the source code automatically because it is not in our database yet. For these cases, you can help by providing the URL of the source code bundle (in zip or jar format) and the database will save the URL. Next time, you or other users will find the source code automatically.