How to compile -g option in Netbeans?

When debugging, I get an exception warning saying 'variable info not available - compiled without -g' - how do I configure compilation with -g in netbeans?

thanks

+4
source share
2 answers

As far as I know, your own code is compiled with debugging information. However, the Java runtime library is not.

Please double check that the location you see this message is in your own code and not in the runtime library.

+7
source

In my Nb 7.4 there is a flag "generate debugging information" on
project properties → Build → compile;

but if you, like me, use maven, you need to also check pom.xml

let me show an example:
you can create a production profile, and in this profile you can have the maven compiler plugin with the debug parameter set to false

  <profile> <id>production</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <encoding>UTF-8</encoding> <source>1.6</source> <target>1.6</target> <showWarnings>true</showWarnings> <debug>false</debug> <optimize>true</optimize> </configuration> </plugin> </plugins> </build> ... 

see false setting
if you have similar settings in the local pom.xml variable during debugging, they are not displayed.

+6
source

Source: https://habr.com/ru/post/1302979/


All Articles