1

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.

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I downloaded source but, when I do like on IBM's link and select node Source Attachment, can't click on Edit button because it's grayed. Beside node it's written: "Source Attachment: (None) - non modifiable."
2

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

1 Comment

I don't know maven. I installed JD-Eclipse and it work. When I do right click on class Result, end select Open Declaration it gives me source. Thanks.
1

right click the class you want to see its implementation in eclipse, and click "Open Declaration F3"

1 Comment

It gives me: "Source not found", and some text below.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.