This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes displaying information from JAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "displaying information from JAR file" Watch "displaying information from JAR file" New topic
Author

displaying information from JAR file

Manu Verma
Greenhorn

Joined: Oct 15, 2007
Posts: 10
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Welcome to JavaRanch.

So where are you stuck implementing this? Do you have a specific question?


Ping & DNS - my free Android networking tools app
Manu Verma
Greenhorn

Joined: Oct 15, 2007
Posts: 10
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 ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
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 ]
Manu Verma
Greenhorn

Joined: Oct 15, 2007
Posts: 10
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());
}
}
}
 
jQuery in Action, 2nd edition
 
subject: displaying information from JAR file