Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created November 25, 2010 04:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rednaxelafx/714896 to your computer and use it in GitHub Desktop.
Save rednaxelafx/714896 to your computer and use it in GitHub Desktop.
A script to verify classes within a JAR file. Depends on the ASM, specifically asm-all-<ver>.jar. Edit the ASM_PATH constant to match your installation. Requires Ruby 1.9+
#!/usr/bin/env ruby
ASM_PATH = "asm-all-3.3.jar"
SEP = File::PATH_SEPARATOR
jar_file, additional_classpath = ARGV
raise "usage: check_jar <jar_file> <additional_classpath>" unless jar_file
`jar tf #{jar_file}`.lines.grep(/\.class$/i).
map {|s| s.chomp[0..-7].gsub '/', '.'}.
each do |c|
puts "checking #{c}"
`java -cp #{[ASM_PATH, jar_file, additional_classpath].compact.join(SEP)} org.objectweb.asm.util.CheckClassAdapter #{c}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment