[英]Analyze and get code/string of a jar file - Java
I want to analyze the code (or strings) of a jar file (example: if a jar file contains "cheese"), I searched a lot but I don't know how to do this :/ I don't want to use JD-GUI because my program have to be automatic (user press a button and then he have to know if a jar file contains a specific method (for example "public void onEnable()" or a string (for example "cheese")) 我想分析jar文件的代码(或字符串)(例如:如果jar文件包含“奶酪”),我进行了很多搜索,但我不知道该怎么做:/我不想使用JD-GUI,因为我的程序必须是自动的(用户按下按钮,然后他必须知道jar文件是否包含特定方法(例如“ public void onEnable()”或字符串(例如“ cheese”)))
I searched and I found: 我搜索后发现:
analyze jar file programmatically 以编程方式分析jar文件
Extract source code from .jar file 从.jar文件中提取源代码
https://tomassetti.me/getting-started-with-javaparser-analyzing-java-code-programmatically/ https://tomassetti.me/getting-started-with-javaparser-analyzing-java-code-programmatically/
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javap.html
Something along these lines: 遵循以下原则:
A quick (Linux) alternative, for classes names only, is this: 仅针对类名称的一种快速(Linux)替代方法是:
jar tvf file.jar | jar tvf file.jar | grep ClassName
grep类别名称
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.