File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Get the list of packages, classes in packages and methods in class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Get the list of packages, classes in packages and methods in class" Watch "Get the list of packages, classes in packages and methods in class" New topic
Author

Get the list of packages, classes in packages and methods in class

Serkan Demir
Ranch Hand

Joined: Feb 03, 2005
Posts: 61
Hi everybody,

I am working on a code generation project with Velocity. In order to use as parameters, I have to get the list of packages, classes in packages and methods in classes and put them into different array lists.
Is there any built-in libraries or java methods for these operation?

thanks lot,

Serkan


A guy from Turkey<br /><a href="http://blogspot.serkandemir.com" target="_blank" rel="nofollow">http://blogspot.serkandemir.com</a>
Satish SN
Ranch Hand

Joined: Apr 19, 2005
Posts: 70
U can get the Information from java.lang.Class


Satish SN<br />SCJP 1.4 & SCWCD 1.4
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

java.lang.Class can, indeed, tell you the methods in a class; but the only way to get a list of packages or a list of classes in a package is by examining the class path and searching for .class files both in and out of JAR files along that class path. This is a bit easier if you can limit the scope of your query to the classes loaded by a custom classloader that you created yourself, so you know exactly where it's searching.

This is not even close to a "Beginner" topic, so I'm going to move this to Java in General (Intermediate).


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get the list of packages, classes in packages and methods in class