Skip to content
Advertisement

jni.h no such file or directory

To install leJos for NXJ brick i follow the documentation tutorial , i set the variables like this : `

export NXJ_HOME=$HOME/leJOS_NXJ_0.9.1beta-3

export LEJOS_NXT_JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

export PATH=$HOME/mohand/leJOS_NXJ_0.9.1beta-3/bin:$PATH

` i go to build directory to make the ant command in the terminal and the build failed with the following error , i know the problem is surely in jni.h and i tried to fix it but i can’t :

 Buildfile: /home/mohand/leJOS_NXJ_0.9.1beta-3/build/build.xml

jlibnxt:

clean:

jlibnxt:
       [cc] 1 total files to be compiled.
       [cc] In file included from /home/mohand/leJOS_NXJ_0.9.1beta-3/build/libnxt/main_jlibnxt.c:30:0:
       [cc] /home/mohand/leJOS_NXJ_0.9.1beta-3/build/libnxt/jlibnxt.h:2:10: fatal error: jni.h: Aucun fichier ou dossier de ce type
       [cc]  #include <jni.h>
       [cc]           ^~~~~~~
       [cc] compilation terminated.

BUILD FAILED
/home/mohand/leJOS_NXJ_0.9.1beta-3/build/build.xml:87: The following error occurred while executing this line:
/home/mohand/leJOS_NXJ_0.9.1beta-3/build/libnxt/build.xml:39: gcc failed with return code 1

Total time: 0 seconds

Advertisement

Answer

Did you ever manage to get this working? I eventually got it to work and had to change the following line in build.xml:

<condition property="jni.include.dir" value="${java.home}/../include">

To:

<condition property="jni.include.dir" value="${java.home}/include">

Apparently behaviour used to be to append /jre to JAVA_HOME hence the need for /../ but it appears this no longer happens.

Hope this helps and you haven’t given up.

Edit: I should also add that you will need to use Java 8. After installing OpenJDK 8 (and editing the build.xml) I was able to run ant to complete the build and then compile, link and upload from the terminal. If you want to use eclipse with the plugin you will need to use version 2018-09 as that’s the latest that works. Remeber to set the JRE to Java 8. After this everything works for me!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement