tags:

views:

170

answers:

5

I'm rediscovering Java, and I'm a little lost about how to do this within Eclipse. I am looking sort of for Visual Studio "object browser" functionality, but I'd settle for a quick list of types that are defined within my referenced external jar files.

+1  A: 

One way is just to expand the jar file (as if it were a directory), which will show its contents.

I don't know of any way of showing just a list of types within a single jar file.

Jon Skeet
+1  A: 

Add the jar to project's build path (right-click menu) It would appear as a Jar (glass one), with arrow to open it as if it was a directory. Now, open it, you'll see its contents - packages containing classes.

But, I advice you to look for javadocs first. Who needs that class list when you've got javadoc!

alamar
+1  A: 

The Package Explorer allows you to browse the contents of your project files as objects, once you expand a package you'll see the classes which you can expand a class to see its methods.

Similarly projects have a "Reference Libraries" section which will expand to show the jars a project depends on and so allow browsing into their packages/classes/methods.

When looking at a class/interface you can hit F4 (or use the right click menu) to see it in its type hierarchy.

Tom
+1  A: 

Cntrl+Shift+T would list down all your types, within all the referenced .jars

pugmarx
A: 

The proper way to do this:

First, import the Jar into your project's build path using Project Properties...

Then, open the Java Browsing perspective.

Click on the Jar you would like to browse in the projects view.

Click on each package in the package view - the types will display in the types view.

Quick tip: CTRL + SHIFT + T (Open Type...) will allow you to open the types of anything Eclipse recognizes as a Java type, regardless of location (it may be in a jar). CTRL + SHIFT + R (Open Resource...), however, will not - only opens resources in your current project, so though you will get access to local classes, you will not be able to open anything that is in a jar.

MetroidFan2002