Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

java - 如何“反编译” Java类文件? [关闭](How do I “decompile” Java class files? [closed])

What program can I use to decompile a class file?

(我可以使用什么程序来反编译类文件?)

Will I actually get Java code, or is it just JVM assembly code?

(我实际上会得到Java代码,还是仅仅是JVM汇编代码?)

On Java performance questions on this site I often see responses from people who have "decompiled" the Java class file to see how the compiler optimizes certain things.

(关于该站点上的Java性能问题,我经常看到已经“反编译” Java类文件以查看编译器如何优化某些东西的人们的回答。)

  ask by Kip translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update February 2016:

(2016年2月更新:)

www.javadecompilers.com lists JAD as being:

(www.javadecompilers.com将JAD列出为:)

the most popular Java decompiler, but primarily of this age only.

(最受欢迎的Java反编译器,但仅限于这个时代。)

Written in C++, so very fast.

(用C ++编写,非常快。)
Outdated, unsupported and does not decompile correctly Java 5 and later

(过时,不受支持且无法正确反编译Java 5及更高版本)

So your mileage may vary with recent jdk (7, 8).

(因此,您的里程可能会因最近的jdk而异(7,8)。)

The same site list other tools.

(同一站点列出了其他工具。)

And javadecompiler, as noted by Salvador Valencia in the comments (Sept 2017), offers a SaaS where you upload the .class file to the cloud and it returns you the decompiled code.

(如萨尔瓦多·瓦伦西亚Salvador Valencia)评论中 (2017年9月)所述,javadecompiler提供了一个SaaS,您可以在其中将.class文件上传到云中并返回经过反编译的代码。)


Original answer: Oct. 2008

(原始答案:2008年10月)

  • The final release of JSR 176, defining the major features of J2SE 5.0 (Java SE 5), has been published on September 30, 2004.

    (定义J2SE 5.0(Java SE 5)的主要功能的JSR 176的最终版本已于2004年9月30日发布。)

  • The lastest Java version supported by JAD, the famous Java decompiler written by Mr. Pavel Kouznetsov, is JDK 1.3 .

    (由Pavel Kouznetsov先生编写的著名Java反编译器JAD支持的最新Java版本是JDK 1.3 。)

  • Most of the Java decompilers downloadable today from the Internet, such as “DJ Java Decompiler” or “Cavaj Java Decompiler”, are powered by JAD: they can not display Java 5 sources.

    (目前,可从Internet下载的大多数Java反编译器(例如“ DJ Java Decompiler”或“ Cavaj Java Decompiler”)均由JAD提供支持:它们无法显示Java 5源。)

Java Decompiler (Yet another Fast Java decompiler) has:

(Java Decompiler (还有另一个Fast Java decompiler)具有:)

  • Explicit support for decompiling and analyzing Java 5+ “.class” files.

    (明确支持反编译和分析Java 5+ “ .class”文件。)

  • A nice GUI:

    (一个不错的GUI:)

屏幕截图

It works with compilers from JDK 1.1.8 up to JDK 1.7.0, and others ( Jikes , JRockit , etc.).

(它可以与从JDK 1.1.8到JDK 1.7.0以及其他版本( JikesJRockit等)的编译器一起使用。)

It features an online live demo version that is actually fully functional!

(它具有一个在线实时演示版本 ,实际上功能齐全!)

You can just drop a jar file on the page and see the decompiled source code without installing anything.

(您只需将jar文件放在页面上,即可查看反编译的源代码,而无需安装任何内容。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...