jni.h:没有这样的文件或目录
问题描述:
我一直在关注本教程,在第5步,我从GCC获取以下输出:
I have been following this tutorial, and at step 5, I am getting the following output from GCC:
HelloWorld.c:1:17: error: jni.h: No such file or directory
In file included from HelloWorld.c:3:
HelloWorld.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
HelloWorld.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
我知道他包含的目录因系统而异,以适应命令相应,但我似乎无法找到我的系统上正确的目录。我使用的是Ubuntu 10.04LTS。
I know that he include directories vary from system to system, so I tried to adapt the command accordingly, but I cannot seem to find the correct directory on my system. I am using Ubuntu 10.04LTS.
答
打开一个终端并输入:
locate jni.h
其中每个文件称为jni.h在您的系统上。我在ubuntu 11.04,它位于:
That should tell you where every file called jni.h is on your system. I am on ubuntu 11.04, and it's located at:
/usr/lib/jvm/java-6-openjdk/include/jni.h
/usr/lib/jvm/java-6-sun-1.6.0.26/include/jni.h
您可能还需要从仓库中获取它:
You may also need to get it from the repos:
sudo apt-get install openjdk-6-jdk
如果你没有安装它,应该做的。
should do the trick if you don't have it installed.