Hi ,
I have a jar file and I want to know which all classes are within it. Is there any way I can do that?
Hi ,
I have a jar file and I want to know which all classes are within it. Is there any way I can do that?
A jar file is just a fancy zip archive. You can use the classes in the java.util.jar package to read a jar file and traverse its contents, looking for .class files.
How about using jar
jar tf jar-file
t
option indicates that you want
to view the table of contents of the
JAR file.f
option indicates that the JAR
file whose contents are to be viewed
is specified on the command line.
Without the f option, the Jar tool
would expect a filename on stdin.jar-file
argument is the filename
(or path and filename) of the JAR
file whose contents you want to view.and if you want to list just the .class
files you can filter the result using grep
as:
jar tf jar-file | grep '\.class$'