java 可以反编译jar文件以获得原始源吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6901230/
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
Can jar files be decompiled to get original source?
提问by Michael Rentmeister
I have a major problem that happened to me. I am writing a program that has taken me 3 months+ to make and today I accidentally deleted the source code.
我有一个发生在我身上的大问题。我正在编写一个花了我 3 个月以上的时间来制作的程序,今天我不小心删除了源代码。
I am working in NetBeans and I had just cleaned and built it, so I still have the working .jar file. The program was saved on a flash drive, not my computer, so the classes are not in the recycling bin.
我在 NetBeans 中工作,我刚刚清理并构建了它,所以我仍然有可用的 .jar 文件。该程序保存在闪存驱动器上,而不是我的电脑上,因此课程不在回收站中。
Can anyone tell me about how I can go about getting my source code back?
谁能告诉我如何才能恢复我的源代码?
回答by tskuzzy
Unless you explicitly packaged your source code in the JAR file, there's no way to get back the original source. You could try using a decompiler (like this) but that will hardly give you nice, readable code.
除非您将源代码明确打包在 JAR 文件中,否则无法取回原始源代码。您可以尝试使用反编译器(像这样),但这很难为您提供漂亮、可读的代码。
The best solution would be to stop using your computer right now. Then use a recovery tool to recover your deleted files. The more recently it was deleted, the higher the chance you'll get it back. There are lots of tools that can be used to do this (just Google it).
最好的解决方案是立即停止使用您的计算机。然后使用恢复工具恢复已删除的文件。它被删除得越近,您找回它的机会就越大。有很多工具可用于执行此操作(只需 Google 即可)。
回答by digitaljoel
You can use a decompiler ( see How to decompile a whole Jar file?) but you won't be getting "original" source back.
您可以使用反编译器(请参阅如何反编译整个 Jar 文件?),但您不会获得“原始”源代码。