Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code

 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any body know how to rereive java packages in classpath through java program !!!
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
http://www.avitek.com/landers/findclass.java.txt
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
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave ....
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How DO you pronounce that first name
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic