Laurențiu Dascălu
Laurențiu Dascălu

Reputation: 2069

Check if Java bytecode contains debug symbols

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.

Upvotes: 28

Views: 13017

Answers (2)

Stephen C
Stephen C

Reputation: 718758

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.

Upvotes: 30

Raindog
Raindog

Reputation: 1488

The most important thing a class file with debug information will contain is the LineNumberTable which maps bytecode instructions to source line numbers and the LocalVariableTable which tells the debugger where your local variables, including arguments to a method reside inside the VM during execution.

Upvotes: 17

Related Questions