11

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.

Haris Krajina
  • 14,824
  • 12
  • 64
  • 81

2 Answers2

11

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.

Community
  • 1
  • 1
alexsmail
  • 5,661
  • 7
  • 37
  • 57
1

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

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
  • My question is more about reverse-process, how can I from .class file know if it was compiled with -g or maybe -g:none (no debug info) option? Thanks for the link. – Haris Krajina Dec 13 '11 at 15:06