在Netbeans 7.2中运行c++程序时出现java.lang.NullPointer异常

java.lang.NullPointer Exception when running C++ Programs in Netbeans 7.2

本文关键字:java lang 异常 NullPointer 程序 Netbeans c++ 运行      更新时间:2023-10-16

我想尝试一下c++,并想使用相同的netbeans IDE,因为我一直在使用它进行Java开发。我下载了Cygwin工具并相应地设置了IDE。当我尝试运行应用程序时,它说构建成功了…,

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/LJee/netbeans/tut-install/CppApplication_1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cppapplication_1.exe
make[2]: Entering directory `/cygdrive/c/Users/LJee/netbeans/tut-install/CppApplication_1'
make[2]: `dist/Debug/Cygwin-Windows/cppapplication_1.exe' is up to date.
make[2]: Leaving directory `/cygdrive/c/Users/LJee/netbeans/tut-install/CppApplication_1'
make[1]: Leaving directory `/cygdrive/c/Users/LJee/netbeans/tut-install/CppApplication_1'

BUILD SUCCESSFUL (total time: 450ms)

但是程序不会运行。它抛出一个Java空指针异常。

java.lang.NullPointerException

RUN FAILED (exit value -1, total time: 26ms)

由于c++程序中没有Java代码,这必然是IDE的一个问题。我在Netbeans论坛上看到了这个帖子http://forums.netbeans.org/topic52231.html

这里用户更改了IDE版本,而我不想这样做。

有没有遇到过这种情况的人可以帮助我?我很高兴!提前感谢!!

我在Linux Mint 18 Cinnamon with Netbeans 8.1下遇到了同样的问题,我通过右键单击项目名称item -> Properties -> Run -> Console Type -> "Standard output"

之后的"Run"命令工作完美。

我找到了解决方案,您必须将Cygwin路径(C: Cygwin bin)添加到环境路径变量中,然后它可以正常工作?查看链接https://netbeans.org/community/releases/72/cpp-setup-instructions.html#compilers

当我将Ubuntu从14.04 LTS升级到16.04 LTS并通过Synaptic将NetBeans IDE从8.0.2升级到8.1时,我遇到了同样的问题。我猜我的JVM安装搞砸了。我的解决方案是用Synaptic卸载NetBeans 8.1,然后从https://netbeans.org/downloads/(all-in installer)下载并安装相同的8.1版本。

相关文章: