Forums Register Login

displaying information from JAR file

+Pie Number of slices to send: Send
I want make such Java program which can display all classes and their methods & constructors of given Package, also it can read from JAR file.

Means, either I give package path or JAR file path, it should display all contains classes, methods and constructors.
+Pie Number of slices to send: Send
Welcome to JavaRanch.

So where are you stuck implementing this? Do you have a specific question?
+Pie Number of slices to send: Send
Thanks.
I am working on application which requires the specific, actually I have made this, which displays classes and methods of a particular given method, but it doesn't work for JAR files, and I want to make it for JAR files also.

p


[ UD: Please UseCodeTags ]
[ October 16, 2007: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
I don't see any code that would open a jar file and access its contents. You can use the java.util.jar.JarFile class for this.
[ October 16, 2007: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
Thanks a ton, I have used this and code is working fine -
public class JarFileInfo {

public static void main(String args[]) throws IOException{
JarFile j = new JarFile("abc.jar");
Enumeration e = j.entries();
while(e.hasMoreElements()){
System.out.println(e.nextElement());
}
}
}
I've never won anything before. Not even a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1146 times.
Similar Threads
Are jars in EAR available
Images in a JAR
LOADING CLASS FROM A JAR WHICH IS NOT IN CLASSPATH
Compiling errata for K&B, SCJP 6
How to enumerate jar files and the classes in them?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:50:25.