Monday, September 24, 2007

Simpler GUI for Jad, The Java Decompiler from As I Learn

This is definitely the most useful two-liner I've seen in a while:
Simpler GUI for Jad, The Java Decompiler.

I naturally customized it to:



jad -o -s java -lnc -d%TEMP% %1
"C:\Program Files\TextPad 5\TextPad.exe" %TEMP%.\%~n1.java

Changed extension to java so that textpad does syntax highlighting; added -lnc so that jad outputs the original line numbers as comments and I can trace the exceptions I get

(after a few questions from people i'm editing this post:)
You will need to download jad and extract the exeutable to somewhere on your path, say C:\windows (or c:\winnt). Then create a new .cmd file, paste the above into the .cmd file, and put it somewhere. Then rightclick any .class file you can find, choose "Open With..."->"Choose Program"->"Browse..." and find the cmd file you created (don't forget to check the "Always use this program"). This way, any .class you'll double-click will decompile and open in textpad.

3 comments:

  1. Inspired by your method, I developed a Linux version.
    ====================================
    #! /bin/sh
    if [[ ! -z "$1" ]] ; then
    jad -b -ff -o -s java -d/tmp $1
    b=${1##*/}
    f=/tmp/${b%.class}.java
    echo $f
    if [[ -f $f ]] ; then
    gedit $f
    fi
    else
    echo "Usage: jad.sh class-file"
    fi
    ====================================

    ReplyDelete
  2. DJ Java Decompiler comes with jad.

    ReplyDelete
  3. since the original jad site is down i've put a link to jad.exe here http://dl.getdropbox.com/u/1748643/jad.exe

    ReplyDelete

[Due to much spam, comments are now moderated and will be posted after review]