Wednesday, March 14, 2007

Decompiling a jar file on windows

One way to do this (and I can never remember the command, which is why I blog it):
  • unpack the jarfile using winzip or the "compressed file" tool on WinXP.
  • use the MS-DOS "for" command combined with the JAD decompiler to decompile:

    for /R %F in (*.class) do jad -r -ff -s java %F

    This will recurse over all the classfiles, decompiling them in turn and leaving the original package/directory structure intact.

There are of course other decompilers available but this will do it in a pinch.
If you are using Vim, be sure to also check out the
jad plugin for Vim. With this, you just right-click on a .class file, select "edit with Vim", and have the decompiled class show up in your editor. If you are on Eclipse (or IBM RAD), use the JadClipse plugin to decompile right in you IDE.

8 comments:

Anonymous said...

Great work.

agilan said...

Excellent tool.

rhyolight said...

Well that worked like a charm. Thanks!

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.