DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Jonhnny has posted 4 posts at DZone. View Full User Profile

Decompile Java Classes With Jad

10.29.2008
| 2622 views |
  • submit to reddit
        // decompile java classes

#!/usr/bin/env ruby

# decompile
# Author:   Jonhnny Weslley
# Modified: Out 29, 2008


ARGV[0] ||= "classnames"  # class file names to decompile
ARGV[1] ||= "src/"        # output directory
file = File.open(ARGV[0])
file.each_line do |line|
  if !line.include?"$"
    output=ARGV[1] + line
    `jad -d #{output[0..output.rindex('/')]} -r -o -ff -nonlb -t 4 -space -noctor #{line}`
  end
end