Check if Java bytecode contains debug symbols

Laurențiu Dascălu picture Laurențiu Dascălu · Jun 30, 2010 · Viewed 10.1k times · Source

I would like to know how can I check if a compiled Java class contains debug symbols. The problem is that I compile an application from ant with debug="on", but a specific JVM throws an exception: it says that the debug symbols are missing.

Thanks.

Answer

Stephen C picture Stephen C · Jun 30, 2010

If you run javap -v on the class file, you will see the debug information that is present in the file.

It is worth compiling a simple test class with different -g option settings and looking at the results with javap.

If, you need to know exactly how javap presents the information, it is it is best for you to try it out in your Java installation. The output from the javap command may vary between different Java versions.