反编译.java文件使用Proycon
问题描述:
我有一个项目,将.class
文件转换为.java
文件,在研究期间,我发现Proycon是一个java库,可以帮助做到这一点。不幸的是,我找不到Proycon的任何适当的文档。任何有经验的人使用它,如果是的话,请告诉我用哪种方法将.class转换成.java文件并将其打印到控制台?反编译.java文件使用Proycon
答
JD-core-java https://github.com/nviennot/jd-core-java是jd-core的薄包装。自述文件显示如何在您的项目中使用它。
/* Returns the source of SomeClass from compiled.jar as a String */
new jd.core.Decompiler.decompile("compiled.jar", "com/namespace/SomeClass.class");
/*
* Returns the sources of all the classes in compiled.jar as a Map<String, String>
* where the key is the class name (full path) and the value is the source
*/
new jd.core.Decompiler.decompile("compiled.jar");
/*
* Returns the number of classes decompiled and saved into out_dir
*/
new jd.core.Decompiler.decompileToDir("compiled.jar", "out_dir");
答
使用该闪客最好是我使用procyon-decompiler-0.5.30.jar
从到位桶repo转换。
如果你需要编译一个或多个罐子,请他们复制到文件夹,然后运行:
%JAVA_HOME%\bin\java -jar c:\procyon\procyon-decompiler-0.5.30.jar -o . *.jar
在上面的命令我指定的完整路径procyon
罐子,和-o .
将输出设置为当前文件夹。
可以说,我要检查sentry-logback-1.5.4.jar
,运行上面的命令后,我会用以下结构的工作文件夹结束:
sentry-logback-1.5.4.jar
[io]
`-- [sentry]
`-- [logback]
`-- SentryAppender.java
当时的[与维基主页和作者的联系方式] (https://bitbucket.org/mstrobel/procyon)不够? –
@JasonC我认为我的谷歌找不到链接,你有链接吗? – droidev
点击我评论中的链接...这也是第一个谷歌“procyon反编译器”的结果。 –