简体   繁体   English

构建时发生JNI错误

[英]JNI error while building

I'm following " https://netbeans.org/kb/docs/cnd/beginning-jni-linux.html " Netbeans tutorial for JNI but when I build the project I get this error in the Netbeans output: 我正在遵循“ https://netbeans.org/kb/docs/cnd/beginning-jni-linux.html ”针对JNI的Netbeans教程,但是当我构建项目时,在Netbeans输出中出现了此错误:

cd 'E:\Janhavi\Projects\JNIDemoCdl'
C:\cygwin64\bin\make.exe -f Makefile CONF=Debug clean
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'
rm -f -r build/Debug
rm -f dist/libJNIDemoCdl.so
make[1]: Leaving directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'

CLEAN SUCCESSFUL (total time: 356ms)
cd 'E:\Janhavi\Projects\JNIDemoCdl'
C:\cygwin64\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/libJNIDemoCdl.so
make[2]: Entering directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'
mkdir -p build/Debug/Cygwin-Windows/_ext/4d151f2
rm -f "build/Debug/Cygwin-Windows/_ext/4d151f2/JNIDemo.o.d"
gcc -shared -m64   -c -g -I/cygdrive/C/Program\ Files/Java/jdk1.7.0_79/include -I/cygdrive/C/Program\ Files/Java/jdk1.7.0_79/include/win32 -include /cygdrive/C/Program\ Files/Java/jdk1.7.0_79/include -include /cygdrive/C/Program\ Files/Java/jdk1.7.0_79/include/win32  -MMD -MP -MF "build/Debug/Cygwin-Windows/_ext/4d151f2/JNIDemo.o.d" -o build/Debug/Cygwin-Windows/_ext/4d151f2/JNIDemo.o /cygdrive/E/Janhavi/Projects/JNIDemoCdl/JNIDemo.c
cc1: fatal error: /cygdrive/C/Program Files/Java/jdk1.7.0_79/include: No such file or directory
compilation terminated.
make[2]: *** [nbproject/Makefile-Debug.mk:68: build/Debug/Cygwin-Windows/_ext/4d151f2/JNIDemo.o] Error 1
make[2]: Leaving directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'
make[1]: *** [nbproject/Makefile-Debug.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/e/Janhavi/Projects/JNIDemoCdl'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 557ms)

This is my first attempt with JNI and I am kind of stuck at this point. 这是我对JNI的第一次尝试,在这一点上,我有些卡住了。 Please let me know what's the mistake? 请让我知道怎么了? Thanks in advance. 提前致谢。

Your JNIDemoCdl is calling make inside cygwin64. 您的JNIDemoCdl正在cygwin64内部调用make。 This is the reason you get /cygdrive before each directory name as they are being executed inside cygwin mounted drives. 这是您在每个目录名称之前获得/cygdrive的原因,因为它们是在cygwin安装的驱动器中执行的。

I think the issue is with the space in ' Program Files ' which you end up getting: 我认为问题出在“ 程序文件 ”中的空间上,您最终得到:

cc1: fatal error: /cygdrive/C/Program Files/Java/jdk1.7.0_79/include: No such file or directory compilation terminated. cc1:致命错误:/ cygdrive / C / Program Files / Java / jdk1.7.0_79 / include:没有此类文件或目录编译终止。

Try storing /Java/jdk1.7.0_79/ under a directory with no space in the name and build the project again. 尝试将/Java/jdk1.7.0_79/存储在名称中没有空格的目录下,然后再次构建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM