This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "code" Watch "code" New topic


Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
can any body know how to rereive java packages in classpath through java program !!!
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
You can not do it in a general case.
If you happen to know you have a directory-based CLASSPATH (not url as in applets or whatever), you can do a file search. You have to look thru each entry in java.class.path and search in there. If the entry is a jar, you will have to crack it open to look.
I wrote a command-line program to search for classes, you are welcome to try it.
In the more general case, you will have a ClassLoader that will not tell you (thru the ClassLoader API) where it is getting classes from. So there is no way to do a search without knowing the class names.
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Thanks Dave ....
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
How DO you pronounce that first name

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: code
Similar Threads
zipping as self extracting exe
WA #2 ..... word association
c++ or Java--your suggestions please