I’m looking for a way to extract data from a jar file.
What i need is information about a certain class file including:
– Constructor name
– Public methods (getters, setters and actions.)
– Perhaps if included the javadoc
For example, in Eclipse, when you type your variable and you press ‘.’ behind it, it gives a complete list of methods, so i’m guessing there should be a way to find this data out. (I’d only need the names of the methods, not the actual code.)
Some actual code, pseudocode, instructions or anything else is appreciated.
Extract the jar as a simple zip with ZipFile, as shown in this page:
http://www.java-examples.com/extract-zip-file-subdirectories-using-command-line-argument-example
Then, for each .class file found, use the ClassParser: http://commons.apache.org/bcel/apidocs/org/apache/bcel/classfile/ClassParser.html
A quicker way:
Also with ClassParser’s constructor ClassParser(String zipFile, String fileName) you can get every information you want about the
fileNameclass in yourzipFile