How attach Java source in Eclipse
Attach the Java Source
When you are using a third party library in Java, you don’t have access to the source code of the classes present in the library. If any help is required then either one has to look at the javadoc of the class files or see the source code by attaching the source to classes.
By attaching the source code, we still don’t have the access to change the source code of external classes but the source code is available for reference purposes.
Following are the steps for attaching and viewing the source code of third party classes in Java. Before using these steps, you need the jar file and the corresponding source archive which is attached to the jar library.
Add the jar file to your classpath. Here we will add Apache POI to Eclipse classpath:

Now if we open a class inside Eclipse, the following API methods from HSSFWorkBook class are shown like this:

Now to add the source code to this class and automatically attach the same for other classes, click the Attach Source button in Eclipse IDE

Browse for the source file and click Ok button and the source code for this class and all other classes with in the Apache POI library will be shown inside Eclipse as shown below:

Eclipse Tutorials
