您的位置:首页 > 编程语言 > Java开发

Java decompile tool set

2010-12-12 20:00 190 查看
After a long time research on all of the online resources, finally I found the following tools are the most useful tools in Java bytecode decompiling operation:

DJDecompiler
Jad
Javap
JD-GUI
Jode

1. DJDecompiler:(Current verions is 3.11.11.95)

We can get detail information and binary package from http://www.neshkov.com/.

This tool is based on jad, a famous decompiler in J***A reverse-engineering field, DJDecompiler provide an easy-to-use GUI for our end user, if you like command line tools, you can use jad directly instead of this tool, the disadvantage of using this tool is it only supports JDK1.5 and now jad has stopped its developing, that leads to it cannot support the newest Java class file format, such as annotation technology etc.

2. Jad: (Final version is 1.5.8)

This tool is a very famous tool in java reverse engineering field, most of tools are using it as the background engine for decompiling, we can download it from the following URL: http://www.varaneckas.com/jad.

In order to save time for decompiling work for using this tool, here are 2 windows shell scripts for using this tool to decompile a package.

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

jad_single_jar_decompile.bat

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

SET SRC_JARNAME=%1

SET CUR_PATH=%cd%
PUSHD %CUR_PATH%
cd %DEC_FOLDER%
if exist %SRC_JARNAME% rd /s/q %DEC_FOLDER%/%SRC_JARNAME%
mkdir %SRC_JARNAME%
cd %SRC_JARNAME%
%J***A_HOME%/bin/jar.exe xf %SRC_FOLDER%/%SRC_JARNAME%.jar

if exist %DES_FOLDER%/%SRC_JARNAME% rd /s/q %DES_FOLDER%/%SRC_JARNAME%
mkdir %DES_FOLDER%/%SRC_JARNAME%
%JAD_HOME%/jad.exe -o -r -d%DES_FOLDER%/%SRC_JARNAME% -sjava %DEC_FOLDER%/%SRC_JARNAME%/**/*.class
REM C:/Java/Decompiler/jad.exe -o -r -dD:/Iris -sjava D:/Private/IrisHubCMServerServer/IrisHubCMServerServer.100914/**/*.class
POPD

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



Another integrated command line for combining this tool and it can be used to decompile a whole jar file:

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

@echo off

REM Set environment variables at first and then decompile all of them...
SET J***A_HOME=C:/Java/jdk1.6
SET JAD_HOME=C:/Java/Decompiler
SET SRC_FOLDER=D:/Iris/bin
SET DEC_FOLDER=D:/Iris/dec
SET DES_FOLDER=D:/Iris/src

call single_jar_decompile.bat XXXXX (Name of jar file, .jar is not included).

@echo on

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

3. javap: this tool is included in jdk package, and it can only be used for decompiling assemble code for java bytecode(class file set), windows shell script is like the following:

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

SET CLASSPATH=D:/Iris/dec/XX

javap -private com.xx.collection.SoftHashMap -classpath %CLASSPATH%

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

4. JD (current version is 0.3.3)

This is very famous and new tool in J***A reverse-engineering field, and it can decompile the newest java class file even include the sharpest Jdk1.7 file, it has several tools including windows GUI tool and eclipse plugin tool, we can download them from the following URL:

Root URL: http://java.decompiler.free.fr/?q=jdeclipse

Plugin update URL: http://java.decompiler.free.fr/jd-eclipse/update

This tool is the best open source tool compared with the other tools, and its speed is the fastest, it's written by C/C++ and parsing the class file directly, it has no dependency requirement in Java.

5. Jode (Final version is 1.1.2)

This is also a very smart tool in J***A reverse-engineering field, and it has stopped its development, it's written in Java and it has a lot of limitation such as Java package/namespace dependency check or something like this, we can use this tool in 2 ways:

-> Install Jode plugin for Eclipse(only for Eclipse3.0)

Update URL: http://www.technoetic.com/eclipse/update

-> Use jode package in command line: (OS shell scripts)

download Jode URL: http://jode.sourceforge.net/download.php

Windows shell script can be written like this:

java -Djava.ext.dirs=D:/Software/Jode;D:/point/Servers/xxx/lib jode.decompiler.Main --dest D:/Software/Jode/src D:/point/Servers/xx/lib/yy.jar
---------------------------------------------------------------------------------------------------------------------------------------------------

Based on our project's experience, no tool could be perfect during the decompiling process, the best combination and procedure should work like this:

A. First use JD-GUI to get all of the source code of the specified jar file(package).

B. Then create a project with all of the necessary library files(jar files), try to compile the specified java source code, you may find a lot of compiling errors.

C. For some method decompiling cannot succeed issues, try to use jad or DJDecompiler to decompile the specified java class or even the whole jar file, try to compare the specified class method's code and merge them in the best way.

D. For some encoding or charset issue, we'll use the Java bytecode editor tool that will be described in the coming articles.

E. Solve all of the above issues and then you will get the whole source code set finally.

More practice, more experience.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: