Does anybody know some opensource project could parse .class file format? Without source code, I could unzip the JAR file, and I try to get the class name, function name or some strings something like that contains in the class file, is that possible?
有谁知道一些开源项目可以解析.class文件格式?没有源代码,我可以解压缩JAR文件,并尝试获取类名,函数名或类似包含在类文件中的字符串,这可能吗?
2 个解决方案
#1
4
I think you are looking for the JarInputStream For the actual .class file you can use BCEL or ASM
我认为您正在寻找JarInputStream对于实际的.class文件,您可以使用BCEL或ASM
#2
0
If all you need is to inspect a jar at coding time then, as suggested by Jon Skeet and Tom Anderson in the comments, javap
will take a .class file and extract the function names and such.
如果您只需要在编码时检查jar,那么,正如Jon Skeet和Tom Anderson在评论中所建议的那样,javap将获取.class文件并提取函数名称等。
If you need a solution to work at run time, then you could use a combination of a jar/zip file reader and Java's inbuilt reflection capabilities as shown in this example. This would let you find/construct the fully qualified names of any classes from the jar and then programatically pull information from them.
如果您需要一个在运行时工作的解决方案,那么您可以使用jar / zip文件阅读器和Java的内置反射功能的组合,如本例所示。这将允许您从jar中查找/构造任何类的完全限定名称,然后以编程方式从中提取信息。
#1
4
I think you are looking for the JarInputStream For the actual .class file you can use BCEL or ASM
我认为您正在寻找JarInputStream对于实际的.class文件,您可以使用BCEL或ASM
#2
0
If all you need is to inspect a jar at coding time then, as suggested by Jon Skeet and Tom Anderson in the comments, javap
will take a .class file and extract the function names and such.
如果您只需要在编码时检查jar,那么,正如Jon Skeet和Tom Anderson在评论中所建议的那样,javap将获取.class文件并提取函数名称等。
If you need a solution to work at run time, then you could use a combination of a jar/zip file reader and Java's inbuilt reflection capabilities as shown in this example. This would let you find/construct the fully qualified names of any classes from the jar and then programatically pull information from them.
如果您需要一个在运行时工作的解决方案,那么您可以使用jar / zip文件阅读器和Java的内置反射功能的组合,如本例所示。这将允许您从jar中查找/构造任何类的完全限定名称,然后以编程方式从中提取信息。