jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes finding packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "finding packages " Watch "finding packages " New topic
Author

finding packages

Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
how to list all the packages in my class path using a java program?


for eg. if the class path is c:\ajay;
and ajay contains two folders pack1(i.e a package) and pack2(i.e a general folder not a package)

in pack1 there are 2 java file which has package pack1; as their first statement.

in pack2 there are two java file which does not contain package statement.

so can i identify between pack1 which is a package and pack2 which is a general folder
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Both aren't packages, because the class-file has to be in a certain folder, not the java file.


http://home.arcor.de/hirnstrom/bewerbung
Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
sorry i meant class files not java files my mistake

but what i want to know is,how to differentiate between a package and an ordinary folder

what i want to do is to list all the class files in a particular folder(path)say D:\ and i have a package in D:\ called test then i should be able to list all the classes in path which includes test package such as test.Test now how do i know that test is an package and not a folder
[ November 28, 2004: Message edited by: Rajagopal Manohar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finding packages
 
Similar Threads
Issue when compiling a class which is importing a package
dumb qn on Packages
Compiling java files in different packages with single javac command
Doubt on packages with jar file
Package Problem