如何在Netbeans中使用-g选项进行编译?

时间:2021-05-15 03:12:17

When debugging I get an warning message on exception saying 'variable info not available - compiled without -g' - how do I set to compile with -g in netbeans?

在调试时,我收到一条警告消息,说明'变量信息不可用 - 编译时没有-g' - 如何在netbeans中设置使用-g进行编译?

thanks

2 个解决方案

#1


7  

As far as I know your own code is compiled with debug information. The Java runtime library, however, isn't.

据我所知,您自己的代码是使用调试信息编译的。但是,Java运行时库不是。

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

请仔细检查您看到此消息的位置是否在您自己的代码中,而不是运行时库中。

#2


6  

In my Nb 7.4 there is a "generate Debuging info" flag on
project propertyes -> Build -> compile ;

在我的Nb 7.4中,项目属性上有一个“生成Debuging info”标志 - > Build - > compile;

but if you, like me, are using maven, you have to check in pom.xml too

但如果你像我一样使用maven,你也必须检查pom.xml

let me show an example:
you can ave a production profile and in that profile you can have the maven compiler plugin with debug setting to false

让我举一个例子:你可以生成一个生产配置文件,在那个配置文件中,你可以将maven编译器插件的调试设置为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 the false setting
if you have a similar setting on your pom.xml local variable on debug are not show.

如果您的pom.xml上的类似设置没有显示,那么请参阅false设置。

#1


7  

As far as I know your own code is compiled with debug information. The Java runtime library, however, isn't.

据我所知,您自己的代码是使用调试信息编译的。但是,Java运行时库不是。

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

请仔细检查您看到此消息的位置是否在您自己的代码中,而不是运行时库中。

#2


6  

In my Nb 7.4 there is a "generate Debuging info" flag on
project propertyes -> Build -> compile ;

在我的Nb 7.4中,项目属性上有一个“生成Debuging info”标志 - > Build - > compile;

but if you, like me, are using maven, you have to check in pom.xml too

但如果你像我一样使用maven,你也必须检查pom.xml

let me show an example:
you can ave a production profile and in that profile you can have the maven compiler plugin with debug setting to false

让我举一个例子:你可以生成一个生产配置文件,在那个配置文件中,你可以将maven编译器插件的调试设置为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 the false setting
if you have a similar setting on your pom.xml local variable on debug are not show.

如果您的pom.xml上的类似设置没有显示,那么请参阅false设置。