{"id":1811,"date":"2015-01-21T23:15:08","date_gmt":"2015-01-21T15:15:08","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=1811"},"modified":"2015-01-21T23:15:08","modified_gmt":"2015-01-21T15:15:08","slug":"%e5%b0%86-class%e6%96%87%e4%bb%b6%e5%8f%8d%e7%bc%96%e8%af%91%e4%b8%ba-java%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/1811.html","title":{"rendered":"\u5c06.class\u6587\u4ef6\u53cd\u7f16\u8bd1\u4e3a.java\u6587\u4ef6"},"content":{"rendered":"<p>\u5de5\u4f5c\u4e2d\u78b0\u5230\u4e86\u8fd9\u6837\u7684\u9700\u6c42\uff0c\u8bb0\u5f97\u4e4b\u524d\u8bd5\u8fc7\u4e00\u4e9b\uff0c\u8fd9\u6b21\u53c8\u627e\u5230\u4e86\u4e0d\u9519\u7684\u8bf4\u660e\uff0c\u9042\u8bb0\u5f55\u4e00\u4e0b\uff0c\u505a\u4e2a\u5907\u5fd8\uff1a<\/p>\n<h6>\u641c\u7d22\u5173\u952e\u5b57\uff1a<\/h6>\n<p><a href=\"http:\/\/search.aol.com\/aol\/search?q=convert+class+to+.java\" target=\"_blank\">http:\/\/search.aol.com\/aol\/search?q=convert+class+to+.java<\/a><\/p>\n<h5>\u4e00\u3001\u4f7f\u7528javap\u547d\u4ee4\uff08Java\u81ea\u5e26\uff09<\/h5>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/6225537\/convert-class-to-java\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/6225537\/convert-class-to-java<\/a><\/p>\n<p>The javap command takes class-names without the .class extension. Try<\/p>\n<pre class=\"lang:default decode:true\">C:\\&gt; javap -c ClassName<\/pre>\n<p><span style=\"color: #ff0000;\">javap will however not give you the implementations of the methods in java-syntax. <strong>It will at most give it to you in JVM bytecode format.<\/strong><\/span><\/p>\n<p>To actually decompile (i.e., do the reverse of javac) you will have to use proper decompiler. See for instance the following related question:<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/272535\/how-do-i-decompile-java-class-files\" target=\"_blank\">How do I &#8220;decompile&#8221; Java class files?<\/a><\/p>\n<h5>\u4e8c\u3001\u4f7f\u7528\u5de5\u5177<\/h5>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/272535\/how-do-i-decompile-java-class-files\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/272535\/how-do-i-decompile-java-class-files<\/a><\/p>\n<ul>\n<li>The final release of JSR 176, defining the major features of J2SE 5.0 (Java SE 5), has been published on September 30, 2004.<\/li>\n<li>The lastest Java version supported by JAD, the famous Java decompiler written by Mr. Pavel Kouznetsov, is <a href=\"http:\/\/varaneckas.com\/jad\/\" target=\"_blank\">JDK 1.3<\/a>.<\/li>\n<li>Most of the Java decompilers downloadable today from the Internet, such as \u201cDJ Java Decompiler\u201d or \u201cCavaj Java Decompiler\u201d, are powered by JAD: they can not display Java 5 sources.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/jd.benow.ca\/\" target=\"_blank\">Java Decompiler<\/a> (Yet another Fast Java decompiler) has:<\/p>\n<ul>\n<li>Explicit support for decompiling and analyzing Java 5+ \u201c.class\u201d files.<\/li>\n<li>A nice GUI.<\/li>\n<\/ul>\n<p>It works with compilers from JDK 1.1.8 up to JDK 1.7.0, and others (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Jikes\" target=\"_blank\">Jikes<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/JRockit\" target=\"_blank\">JRockit<\/a>, etc.).<\/p>\n<p>It features an online <a href=\"http:\/\/jd.benow.ca\/#jd-online\" target=\"_blank\">live demo version<\/a> that is actually fully functional! You can just drop a jar file on the page and see the decompiled source code without installing anything.<\/p>\n<p>====<\/p>\n<p>There are a few decompilers out there&#8230; A quick search yields:<\/p>\n<ol>\n<li><a href=\"https:\/\/bitbucket.org\/mstrobel\/procyon\" target=\"_blank\">Procyon<\/a>: open-source (Apache 2) and actively developed<\/li>\n<li><a href=\"https:\/\/github.com\/Storyyeller\/Krakatau\" target=\"_blank\">Krakatau<\/a>: open-source (GPLv3) and actively developed<\/li>\n<li><a href=\"http:\/\/www.benf.org\/other\/cfr\/\" target=\"_blank\">CFR<\/a>: open-source (MIT) and actively developed<\/li>\n<li><a href=\"http:\/\/www.kpdus.com\/jad.html\" target=\"_blank\">JAD<\/a><\/li>\n<li><a href=\"http:\/\/www.neshkov.com\/\" target=\"_blank\">DJ Java Decompiler<\/a><\/li>\n<li><a href=\"http:\/\/www.brouhaha.com\/~eric\/software\/mocha\/\" target=\"_blank\">Mocha<\/a><\/li>\n<\/ol>\n<p>And many more.<\/p>\n<p>These produce Java code. Java comes with something that lets you see JVM byte code (<a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/technotes\/tools\/windows\/javap.html\">javap<\/a>).<\/p>\n<p>&nbsp;<\/p>\n<h6>\u8865\u5145\u8bf4\u660e\uff1a<\/h6>\n<p>\u4e0a\u9762\u7684\u5185\u5bb9\u633a\u521d\u7ea7\u7684\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u505a\u8fc7\u7279\u6b8a\u5904\u7406\u7684.class\u6587\u4ef6\u5c31\u6ca1\u4ec0\u4e48\u529e\u6cd5\u4e86\uff0c\u8fd9\u91cc\u5c31\u5f53\u662f\u591a\u4e86\u89e3\u4e00\u4e9b\u77e5\u8bc6\u5427\u3002\u73b0\u5728\u6709\u4e86GitHub\uff0c\u5927\u90e8\u5206\u7684\u6e90\u7801\u90fd\u8fd8\u662f\u53ef\u4ee5\u514d\u8d39\u5f97\u5230\u7684\uff0c\u5728\u53cd\u7f16\u8bd1\u4e4b\u524d\uff0c\u5148\u641c\u641c\u770b\u80fd\u5426\u627e\u5230\u6e90\u7801\u5427\uff0c\u514d\u5f97\u767d\u5fd9\u6d3b~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5de5\u4f5c\u4e2d\u78b0\u5230\u4e86\u8fd9\u6837\u7684\u9700\u6c42\uff0c\u8bb0\u5f97\u4e4b\u524d\u8bd5\u8fc7\u4e00\u4e9b\uff0c\u8fd9\u6b21\u53c8\u627e\u5230\u4e86\u4e0d\u9519\u7684\u8bf4\u660e\uff0c\u9042\u8bb0\u5f55\u4e00\u4e0b\uff0c\u505a\u4e2a\u5907\u5fd8\uff1a \u641c\u7d22\u5173\u952e\u5b57\uff1a htt [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,12],"tags":[436,437],"class_list":["post-1811","post","type-post","status-publish","format-standard","hentry","category-security","category-tools","tag-decompile","tag-javap"],"views":5609,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=1811"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1811\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=1811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=1811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=1811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}