DEV Community

Cover image for A new OpenSource java decompiler
Neo Meng
Neo Meng

Posted on

A new OpenSource java decompiler

Garlic is a Java decompiler written purely in C language.

Features

  • decompile .class file
  • decompile jar file
  • decompile war file
  • decompile apk file (coming soon)
  • decompile dex file (coming soon)

Build

requirements: cmake >= 3.26

No other dependencies

git clone https://github.com/neocanable/garlic.git
cd garlic
cmake -B build
cmake --build build
./build/garlic
Enter fullscreen mode Exit fullscreen mode

Usage

  • decompile .class file

    decompile .class file, default output is stdout

    garlic /path/to/jvm.class
    
  • decompile jar file

    garlic /path/to/file.jar
    
    garlic /path/to/file.jar -o /path/to/save # -o option is source code output path
    
    garlic /path/to/file.jar -t 5             # -t option is thread count, default is 4
    

    default output is same level directory as the file

  • javap

    like javap, more faster, disabled LineNumber and StackMapTable attributes

    garlic /path/to/jvm.class -p
    
  • dexdump

    garlic /path/to/dalvik.dex -p           # only support dexdump
    
    

welcome to feedback, issues, or ideas for improvement.

github: https://github.com/neocanable/garlic

Top comments (2)

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more