score:-2
It may seem like overkill, but if you use maven and include source, the mvn eclipse plugin will generate all the source configuration needed to give you all the in-line documentation you could ask for.
score:0
Another thought for making that easier when using an automated build:
When you create a jar of one of your projects, also create a source files jar:
project.jar
project-src.jar
Instead of going into the build path options dialog to add a source reference to each jar, try the following: add one source reference through the dialog. Edit your .classpath and using the first jar entry as a template, add the source jar files to each of your other jars.
This way you can use Eclipse's navigation aids to their fullest while still using something more standalone to build your projects.
score:0
I was going to ask for an alternative to attaching sources to the same JAR being used across multiple projects. Originally, I had thought that the only alternative is to re-build the JAR with the source included but looking at the "user library" feature, you don't have to build the JAR with the source.
This is an alternative when you have multiple projects (related or not) that reference the same JAR. Create an "user library" for each JAR and attach the source to them. Next time you need a specific JAR, instead of using "Add JARs..." or "Add External JARs..." you add the "user library" that you have previously created.
You would only have to attach the source ONCE per JAR and can re-use it for any number of projects.
score:0
score:0
Just click on attach source and select folder path ... name will be same as folder name (in my case). Remember one thing you need to select path upto project folder base location with "\" at suffix ex D:\MyProject\
score:1
Another option is to right click on your jar file which would be under (Your Project)->Referenced Libraries->(your jar) and click on properties. Then click on Java Source Attachment. And then in location path put in the location for your source jar file.
This is just another approach to attaching your source file.
score:1
Another way is to add the folder to your source lookup path: http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fdebug%2Fref-editsourcelookup.htm
score:1
If you build your libraries with gradle, you can attach sources to the jars you create and then eclipse will automatically use them. See the answer by @MichaelOryl How to build sources jar with gradle.
Copied here for your reference:
jar {
from sourceSets.main.allSource
}
The solution shown is for use with the gradle java plugin. Mileage may vary if you're not using that plugin.
score:2
- Put source files into a zip file (as it does for java source)
- Go to Project properties -> Libraries
- Select Source attachment and click 'Edit'
- On Source Attachment Configuration click 'Variable'
- On "Variable Selection" click 'New'
- Put a meaningful name and select the zip file created in step 1
score:3
- Click on the JAVA code you want to see. (Click on List to open List.java if you want to check source code for java.util.List)
- Click on "Attach Source" button.
- You will be asked to "Select the location (folder, JAR or zip) containing the source for rt.jar).
- Select "External location" option. Locate the src.zip file.
- Path for src.zip is : *\Java\jdk1.8.0_45\src.zip
score:4
When you add a jar file to a classpath you can attach a source directory or zip or jar file to that jar. In the Java Build Path properties, on the Libraries tab, expand the entry for the jar and you'll see there's an item for the source attachment. Select this item and then click the Edit button. This lets you select the folder, jar or zip that contains the source.
Additionally, if you select a class or a method in the jar and CTRL+CLICK on it (or press F3) then you'll go into the bytecode view which has an option to attach the source code.
Doing these things will give you all the parameter names as well as full javadoc.
If you don't have the source but do have the javadoc, you can attach the javadoc via the first method. It can even reference an external URL if you don't have it downloaded.
score:5
I've found that sometimes, you point to the directory you'd assume was correct, and then it still states that it can't find the file in the attached source blah blah.
These times, I've realized that the last path element was "src". Just removing this path element (thus indeed pointing one level above the actual path where the "org" or "com" folder is located) magically makes it work.
Somehow, Eclipse seems to imply this "src" path element if present, and if you then have it included in the source path, Eclipse chokes. Or something like that.
score:5
yes there is a easy way... go to ... http://sourceforge.net/projects/jdk7src/ and download the zip file. Then attach this to the eclipse. Give the path where you have downloaded the zip file in eclipse. We can then browse through the source.
score:8
score:14
An easy way of doing this is :
Download the respective SRC files/folder.
In the eclipse editor, Ctrl+click or F3 on a method/class you need the source for. A new tab opens up which says "No attached source found".
Click the "attach sources" button, click the "attach source folder" button, browse to the location of the downloaded SRC folder. Done!
(p.s : Button labels may vary slightly, but this is pretty much it.)
score:110
Up until yesterday I was stuck painstakingly downloading source zips for tons of jars and attaching them manually for every project. Then a colleague turned me on to The Java Source Attacher. It does what eclipse should do - a right click context menu that says "Attach Java Source".
It automatically downloads the source for you and attaches it. I've only hit a couple libraries it doesn't know about and when that happens it lets you contribute the url back to the community so no one else will have a problem with that library.
score:153
Short answer would be yes.
You can attach source using the properties for a project.
Go to Properties (for the Project) -> Java Build Path -> Libraries
Select the Library you want to attach source/javadoc for and then expand it, you'll see a list like so:
Source Attachment: (none)
Javadoc location: (none)
Native library location: (none)
Access rules: (No restrictions)
Select Javadoc location and then click Edit on the right hahnd side. It should be quite straight forward from there.
Good luck :)
Source: stackoverflow.com
Related Query
- Is there an easy way to attach source in Eclipse?
- is there an easy way to import a black-on-white color scheme in Eclipse
- Developing for android, is there a way to cause eclipse to rebuild an app when only the source of its libraries was modified?
- In the Eclipse HTML editor, is there an easy way to have custom tags available in content assist (autocomplete)?
- Is there a way to organize the source tree in Eclipse Java project?
- Is there a way to revert eclipse android ADT from r17 to r16 since javadoc and source attachment is broken?
- Is there an easy way to generate documentation for eclipse without disturbing the code?
- Is there a good way to add Equinox source to Eclipse to help debugging an OSGi bundle?
- Is there a way to quickly capitalize the variable name in Eclipse
- How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
- Is there a way to fold eclipse sub-blocks like an "if" statement?
- Is there way to expand all folders in Eclipse project view and search results?
- Is there a way to hide Maven 2 "target/" folder in Eclipse 3?
- Is there a way to upgrade eclipse and keep all the installed plugins?
- Is there any way to integrate Eclipse with Gradle in Android project?
- How to attach Android Source to Eclipse
- Attach the Source in Eclipse of a jar
- Is there any way of configuring Eclipse IDE proxy settings via an autoproxy configuration script?
- Easy way to copy old plugins into new install of eclipse
- Is there a way to prevent Eclipse from opening the browser when starting a Web application?
- Is there a way to make Eclipse run a JUnit test multiple times until failure?
- Is there a way to force Eclipse to automatically restart remote debugging (in listen mode)?
- Is there a way to add the workspace path to the Eclipse IDE title bar?
- Is there a way to tell Eclipse to "Save all" before building?
- Is there a way in the Eclipse debugger to be notified when the state of a Java object changes?
- Is there a way to have Eclipse automatically make all my variables final?
- In Eclipse, when debugging, is there an easy way to see a variable's total memory size?
- Is there a way to delete meta-data on Eclipse run configurations?
- Is there a way to directly generate Step Definitions in Eclipse without Running Cucumber?
- Is there a way to capitalize the first letter of a value of a variable in Eclipse (Helios) code templates
More Query from same tag
- How do I make my Gradle project automatically built in Eclipse?
- How to open BAT (windows batch) file in Eclipse?
- Android Head First "NASA daily image App"
- Configure Eclipse for J2ME development
- Has LocalContainerEntityManagerFactoryBean.setPersistenceUnitRootLocation been removed in Spring-Boot 1.4.1
- EMF for Eclipse
- How can I set the number of compiling workers (threads) in eclipse?
- Cloning repositories using mercurial eclipse not working on macos 10.8.2
- How to import eclipse library project from github to android studio project?
- My Emulator won't unlock
- Include classes of Mahout math libraries of both core & math folders - Eclipse - Hadoop
- break when any method of class is invoked
- Java equivalent of .Net Solution file type
- LibGDX dual assets setup, Eclipse, Gradle
- Using m2e plugin in a Dynamic Web Project
- problems were detected while vaidating & converting Ecore models. The names are not well formed for model objects in diagram
- How to package dependencies into java project with eclipse
- import repository from github to eclipse get an empty project in eclipse
- Using Sphinx4.0 to build a speech recog. Android application
- JList Left Attached and Filled
- NDK Automatic build in eclipse OSX Invoking autoreconf in build directory:
- Failed to create the part's control Eclipse Xtext
- How to change genymotion installation directory path in eclipse?
- Eclipse CDT C++ - [Main] program not specified
- QuickText (Notepad++) plugin for Eclipse
- how can i modify main method to get input and output from the comandline?
- '(Cannot run program "make": Launching failed) .' in Eclipse
- Why is my "Set Next Statement" disabled?
- Java login program using SQL
- Android eclipse sdk is not installing