0

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
Raymond17
  • 73
  • 1
  • 9
  • your problem isn't in Java but rather in C. Have you included the JNI library in your library path in C? – AminM Nov 12 '20 at 22:36
  • i don't use C and Gcc these days , how i can do this ? – Raymond17 Nov 12 '20 at 22:41
  • I can't really tell what's happening here but I'd guess that you are missing key components when compiling (it says you're using cc). So I'd guess you're missing dependencies in your installation. I haven't had the pleasure of building LeJOS myself. – AminM Nov 12 '20 at 22:54
  • i don't compile , just build with a ant command – Raymond17 Nov 12 '20 at 23:04

1 Answers1

2

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!