How can I determine for any Java .class file if that was compiled with debug info or not?
How can I tell exactly what -g{source|lines|vars} option was used?
Building on the two answers above (Aaron Digulla and Pete Kirkham), you can inspect the jarfile or the classfile directly with javap -v
. I find this a little simpler than using a classpath. Single quotes are needed with the !
for the jarfile case.
javap -v 'jar:file:///Absolute/Path/To/JarFile.jar!/package/name/using/slashes/ClassName.class' | grep "\(Compiled from\|LineNumberTable\|LocalVariableTable\)" | head
or (don't need the absolute path for checking a classfile)
javap -v Path/To/ClassName.class | grep "\(Compiled from\|LineNumberTable\|LocalVariableTable\)" | head
If results are unclear or the format changes, pipe to less
instead of grep
and take a look.