Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know from .class file if debug metadata is included?

Tags:

java

How can I tell if compiled java classes have debug metadata included?

Optional:

It would be nice only if I could see if debug metadata is lines, vars or source or combination of some of them.

Found nice tool for viewing .class files (http://www.codexterity.com/classexp.htm) but that's where I am stuck not sure where to look. Thank you.

like image 344
Haris Krajina Avatar asked Dec 13 '11 13:12

Haris Krajina


2 Answers

Essentially, there is bytecode in the class file that have debug information.

If you run javap -v on the class file, you will see the debug information that is available. It is worth compiling a simple test class with different -g option settings and looking at the results with javap.

See Check if Java bytecode contains debug symbols for more.

like image 195
alexsmail Avatar answered Oct 18 '22 09:10

alexsmail


Normally only line numbers are included but you can use '-g' option this option generates all debugging information, including local variables.

Read about Debug information in Java .class files

like image 36
CloudyMarble Avatar answered Oct 18 '22 07:10

CloudyMarble