# Decompile (反編譯)
###### tags: `Jar Decompile` `Apk Decompile`
[TOC]
# JAR Decompile
## 1. Download JD-GUI
**Click Link:** http://java-decompiler.github.io/
**Download:** File below JD-GUI jar file.

## 2. Open up JD-GUI

**cd "folder containing file"**
Ex: cd C:\Users\Claudia\Downloads
**java -jar "jd-gui file.jar"**
java -jar jd-gui-1.6.6.jar
## 3. Open up

**Note:** If you close cmd, this Java Compiler will also close as well.
# APK Decompile
## Download Tools
1. [ApkTool](https://ibotpeaches.github.io/Apktool/)
1. [JD-GUI](http://java-decompiler.github.io/)
1. [dex2jar](https://sourceforge.net/projects/dex2jar/files/latest/download)
ApkTool turns apk into **smali file and resource file**
dex2jar turns apk into jar, and you can use jd-gui to change it into java code
## ApkTool Usage
apktool must download 2 files **apktool.bat file (wrapper script) && apktool.jar**.
**Note:** To download .bat file, just right click wrapper script > save url as.
These 2 files must be put below C:// window as shown in picture below:

After putting files in right place, use cmd to check whether you can use apktool command.
If **apktool command** can be run, then head cmd to the folder you have your apk file by using **cd command**. After that use **apktool d apkName.apk**, this will create a folder of it in the same path.

apktool d APKNAME.apk
## dex2jar
After downloading dex2jar, it gets a **zip file**. First, zip must be unboxed.
When we are done unboxing, we put the apk we want to check in the folder. Later, by using cmd on the same folder, we use the following command: **d2j-dex2jar.bat -f apkName.apk**. By using this, we will get a jar file. This last one can be opened by **jd-gui**.

## JD-GUI
**cd "folder containing jd-gui file"**
Ex: cd C:\Users\Claudia\Downloads
**java -jar "jd-gui file.jar"**
java -jar jd-gui-1.6.6.jar
Drop the jar file in the window opened.
## APK > ZIP
Change .apk file to .zip, remember to unbox it afterward. You will find a **classes.dex**, drop it in **dex2jar folder** and use the next command **d2j-dex2jar.bat classes.dex**. This last command will provide a jar file which can be opened by using jd-gui.