java jd-gui反编译器无法反编译的Java类文件如何反编译?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11753357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to decompile Java class files which jd-gui decompiler is unable to decompile?
提问by codingscientist
We accidently got some JAVA source files deleted from the system.
我们不小心从系统中删除了一些 JAVA 源文件。
This happened when We checked out a folder from repository directly as an eclipse project and then tried to copy a folder from another eclipse project into this one.Strangely all those folder files have vanished from local system (and obviously they never made it to SVN repository).
当我们直接从存储库中检出一个文件夹作为 Eclipse 项目,然后尝试将另一个 Eclipse 项目中的文件夹复制到这个文件夹时,就会发生这种情况。奇怪的是,所有这些文件夹文件都从本地系统中消失了(显然它们从未进入 SVN 存储库) )。
Somehow We have obtained .svn-base files for some CLASS files.Now We are trying to decompile class files to obtain the source code back. However some of the class files are giving error "invalid input file" when jd compiler is trying to process them. Is there any other solution to this ?
不知何故,我们已经获得了一些 CLASS 文件的 .svn-base 文件。现在我们正在尝试反编译类文件以获取源代码。然而,当 jd 编译器试图处理它们时,一些类文件会给出错误“无效的输入文件”。有没有其他解决方案?
回答by Stephen C
From what I can tell, "jd-gui" is closed source, so you may need to contact the developer to find out what that message means. (If it was open source, we could just look at the source code to figure out what the likely problem was!)
据我所知,“jd-gui”是封闭源代码,因此您可能需要联系开发人员以了解该消息的含义。(如果它是开源的,我们可以查看源代码来找出可能的问题所在!)
However, one thing is clear from various questions that Google shows up, and that is that "jd-gui" doesn't understand how to decompile archives (JAR, EAR, etc). So maybe you just need to un-JAR something to make it work.
但是,从 Google 提出的各种问题中可以清楚地看出一件事,那就是“jd-gui”不了解如何反编译档案(JAR、EAR 等)。因此,也许您只需要取消 JAR 文件即可使其工作。
The other thing you could try (first) is to see what "javap" makes of the class files that "jd-gui" doesn't like.
您可以尝试的另一件事(首先)是查看“javap”对“jd-gui”不喜欢的类文件的构成。
回答by RNJ
Try using JAD to decompile your files.
尝试使用 JAD 来反编译您的文件。
www.varaneckas.com/jad/
www.varaneckas.com/jad/
You may need to unzip your jar files and then run something like the following to decompile them all
你可能需要解压你的 jar 文件,然后运行类似下面的东西来反编译它们
find <srcdirectory> -name *.class -exec jad -s .java -r -ff -clear -debug -d <dest directory> {} \;
I havent tested the above command but hopefully it is almost there...
我还没有测试上述命令,但希望它几乎就在那里......