25

Ex.

javac -g ButtMonkey.java

Where do you configure the -g flag when Eclipse compiles Java source? (Using Ganymede but I doubt that has changed in later versions so any answer probably helps.)

What I need is:

-g

Generate all debugging information, including local variables. By default, only line number and source file information is generated.

Ocaso Protal
  • 19,362
  • 8
  • 76
  • 83
Mifune
  • 370
  • 1
  • 5
  • 14

2 Answers2

22

Select the menu: Window > Preferences > Java > Compiler

There you will find several check boxes under the heading "Classfile Generation".

Jesper
  • 202,709
  • 46
  • 318
  • 350
  • 1
    Oh sneaky, they hide the actual flags from you. Was afraid I was going to have to create a custom builder! – Mifune Feb 28 '12 at 14:12
  • 7
    @Mifune Note that Eclipse uses its own built-in Java compiler (which is not exactly the same as `javac` from the JDK), so there isn't one checkbox which exactly matches what `-g` on `javac` does. – Jesper Feb 28 '12 at 14:48
0

For Eclipse version Photon Release (4.8.0)(Build id: 20180619-1200), Enabling (or disabling) the debug flag in Eclipse IDE,

  1. Window > Preferences > (left option) Java > Compiler
  2. (section) 'Classfile Generation'
  3. (checkbox) 'Add variable attributes to generated class files (used by the debugger)' // Checking this checkbox will enabled the debug flag. Unchecking this checkbox will disable it.

From, Sharma, J; Sarin, Ashish. Getting started with Spring Framework: Third Edition (Kindle Locations 2500-2508). UNKNOWN. Kindle Edition.

Park JongBum
  • 1,245
  • 1
  • 16
  • 27