File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Classes in a package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Classes in a package" Watch "Classes in a package" New topic

Classes in a package

Giri Thava
Ranch Hand

Joined: Jun 22, 2006
Posts: 38
What is the command (to be used in DOS) to see what classes are available in a particular package, for instance, assume I want to see what classes are stored in java.util package. What is the command I should use?

javap java.lang.String just displays the methods and variables.

Advance thanks.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
Are you looking in a .jar? You know that any program which inflates a .zip file will inflate a .jar too; they use virtually the same format? When you have inflated the .jar into folders, use, "cd java, cd util, dir."

You can also find the details of the classes from the standard Java API documentation. Find the overview page with frames, and click on the nams of the package at the top left.

[edit]Corrected anme of package[/edit]
[ February 02, 2008: Message edited by: Campbell Ritchie ]
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
It is impossible to find out all the classes that could possibly be loaded, in a given package, as ClassLoaders do not have to provide enumeration facilities. Also, of course, additional ClassLoaders can be activated at any time, potentially making more classes available.

The above restriction makes sense, if you think about it, but more surprising to me is that you can't easily list all the loaded classes, either. (Or can you?).

If you know all your classes will be loaded by the system ClassLoader, then you can examine the classpath (it's a system property) and then read the directories and Jars to find all the classes.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: Classes in a package
It's not a secret anymore!