This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi EveryBody There, How can i get the name of all classes in specified pacakage from java program. Ex: I want to get each class from java.io.* how can to write a programe for this. don't want to use javap like this Runtime rt = Runtome.getRunTime(); String a = String; a = "java.io.*"; rt.exec("javap.exe",a); I don't want to use this code because this is not a platform independent. suggest me other Options pls.
[ April 08, 2002: Message edited by: Carl Trusiak ]
public class JarFile extends ZipFile The JarFile class is used to read the contents of a JAR file from any file that can be opened with java.io.RandomAccessFile. It extends the class java.util.zip.ZipFile with support for reading an optional Manifest entry. The Manifest can be used to specify meta-information about the JAR file and its entries.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Nov 30, 2000
Thnaks ! i thought in that same way. but i am not much aware about jar and manifests. according to u i have to extract rt.jar file in runtime of my program (this is what i am getting) am i right.. if it is so then tell me some resorces from whre i can get information about jar file and manifests. and just tell me don't u think it will decrease speed and performance of my program.
PS: I have no idea if it will impact the performance of your application. You have not given us a Clue as to what you are doing and why. Frankly, unless you are writing a utility to manipulate class files, you should not really NEED to look in the Jar files with your program. But maybe you are writing an IDE or something.