Java反编译,反编译*.class文件

Java反编译,反编译*.class文件

手头只有class文件,没有*.java,为了获得程序的源代码,只好上谷歌查查了,MOCHA(类似的还有好几款反编译工具),起码对付我现在简单的看看代码的应用奏效了。
前提:安装Java EE SDK,安装一下。(好几年没装过Java了,发现现在的Java改进很大,当然,对于我这种Java盲来说,只是针对安装过程而言了。)
然后后续步骤就参考下面的readme文档了。先下载MOCHA(http://www.brouhaha.com/~eric/software/mocha/)

------------------------------------------------------------------

MOCHA - the Java decompiler - version beta 1


1. LEGAL CRAP

Mocha is copyright 1995, 1996 by Hanpeter van Vliet

Use at your own risk. I do not guarantee the fitness of Mocha for any purpose, and I do not accept responsibility for any damage you do to yourself or others by using Mocha.

The distribution archive (file "mocha-b1.zip") may be distributed freely, provided its contents ("mocha.zip" and this file, "readme.txt") are not tampered with in any way.

2. INSTALLATION

There is no need to unzip the "mocha.zip" file contained in the distribution zip file; Java knows how to get .class files out of zip files. Simply put "mocha.zip" in a safe place, for instance the JDK directory.

Add the full pathname of "mocha.zip" to your CLASSPATH string, for instance:

    SET CLASSPATH=c:\myclasses;c:\jdk\mocha.zip

3. INVOCATION

Mocha is invoked from the commandline (i.e. DOS box, if you're using Win95) like this:

    java mocha.Decompiler [-v] [-o] Class1.class Class2.class ...

Where
   "java"               invokes the Java virtual machine,
   "mocha.Decompiler"   (note the case!) specifies the class to run,
   "-v"                 optionally specifies verbose output,
   "-o"                 optionally overwrites existing .mocha files,
   "ClassX.class"       specifies the .class file(s) to decompile.

Wildcards (* and ?) are accepted.

4. SUPPORT

Mocha is quite useable but far from perfect, I know. It's only a beta, so be gentle with it! There may be cases where Mocha gets confused and it will tell you so. I will continue to improve Mocha to deal with such situations, and to keep up with evolving Java technology.

Improved versions of Mocha will first be made available on

    http://www.inter.nl.net/users/H.P.van.Vliet/mocha.htm

Problems can be reported via the form at

    http://www.inter.nl.net/users/H.P.van.Vliet/problem.htm


你可能感兴趣的:(java,jdk,c,.net,dos)