How to see source code of particular class in eclipse?
I want to see source开发者_开发问答 for particular class. For example, now I work with JUnit and in code have this line:
Result result = JUnitCore.runClasses(MyClassTest.class);
I want to see how is implemented Result class. Is it possible?
I imported JUnit jar into build path. I am using Eclipse 3.6 Helios.
You need to attach source of the corresponding library.
Download Junit's source zip ( from their release site, corresponding to the JUNIT you are using) - example link
Then follow these steps in IBM's link on the topic - with steps
Once you do that, Ctrl + click on the class you interested in - while you are in the editor, you will see its source.
Multiple ways:
- download the sources and add them to the project build path
- use maven and set it to download sources
- use a decompiler - for example JD-Eclipse
right click the class you want to see its implementation in eclipse, and click "Open Declaration F3"
精彩评论