Иван Бишевац
Иван Бишевац

Reputation: 14701

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.

Upvotes: 1

Views: 774

Answers (3)

Sam
Sam

Reputation: 2446

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

Upvotes: 1

Bozho
Bozho

Reputation: 597382

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

Upvotes: 2

ring bearer
ring bearer

Reputation: 20803

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.

Upvotes: 3

Related Questions