致命错误:jni_md.h:没有这样的文件或目录#include"jni_md.h" [英] fatal error: jni_md.h: No such file or directory #include "jni_md.h"
本文介绍了致命错误:jni_md.h:没有这样的文件或目录#include"jni_md.h"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ubuntu上执行gcc
命令以生成JNI的.a或.so文件时,openjdk 8/oraclejdk8的错误均降至错误以下.
While executing gcc
command on ubuntu for generating .a or .so file for JNI, getting below error for both openjdk 8 / oraclejdk8.
$gcc -I/usr/lib/jvm/java-8-openjdk-amd64/include -c MainImpl1.c -o MainImpl1.o
In file included from MainImpl1.c:1:0:
/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h:45:20: fatal error: jni_md.h: No such file or directory
#include "jni_md.h"
^
compilation terminated.
$gcc -I/usr/lib/jvm/java-8-oracle/include -c MainImpl1.c -o MainImpl1.o
In file included from MainImpl1.c:1:0:
/usr/lib/jvm/java-8-oracle/include/jni.h:45:20: fatal error: jni_md.h: No such file or directory
#include "jni_md.h"
^
compilation terminated.
我已经给出了生成.a文件的示例,但是在生成.so文件时也遇到了同样的问题.
I have given example for generating .a file, but same issue observed for .so file generation also.
但是相同的gcc
命令适用于openjdk7/oraclejdk7.
But same gcc
command works for openjdk7/oraclejdk7.
这是什么问题?
推荐答案
我认为您没有添加包含jni_md.h
的包含目录,其中jni_md.h
是
I think that you do not added include directory that includes jni_md.h
which is platform dependent.
尝试
$gcc -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -c MainImpl1.c -o MainImpl1.o
或
$gcc -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -c MainImpl1.c -o MainImpl1.o
如果您不知道jni_md.h在哪里,请使用find
:
If you don't know where jni_md.h is, use find
:
find / -name jni_md.h 2> /dev/null
这篇关于致命错误:jni_md.h:没有这样的文件或目录#include"jni_md.h"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文