(Ubuntu) Ant trouble - jni.h: No such file or directory

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: imaqine, 99jonathan, roger

PXS710
New User
Posts: 4
Joined: Fri Jan 12, 2018 5:34 pm

(Ubuntu) Ant trouble - jni.h: No such file or directory

Postby PXS710 » Fri Jan 12, 2018 6:00 pm

I'm trying to install leJOS and have gotten to the stage where I need to build the java native library.

I'm following this tutorial: https://youtu.be/rVCt5E1CvZU?t=7m40s

But when I enter the build folder and enter 'ant' (as shown in the video above) I get the following error:

pierce@pierce-VirtualBox:~/Downloads/leJOS_NXJ_0.9.1beta-3/build$ ant
Buildfile: /home/pierce/Downloads/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/pierce/Downloads/leJOS_NXJ_0.9.1beta-3/build/libnxt/main_jlibnxt.c:30:0:
[cc] /home/pierce/Downloads/leJOS_NXJ_0.9.1beta-3/build/libnxt/jlibnxt.h:2:17: fatal error: jni.h: No such file or directory
[cc] #include <jni.h>
[cc] ^
[cc] compilation terminated.

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

Total time: 0 seconds


I've been looking for a solution for a couple of days but haven't found anyone with the same issue, so any help would be appreciated.

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby gloomyandy » Fri Jan 12, 2018 8:25 pm

jni.h is part of the Java SDK, you need to make sure your have the build options setup correctly...
https://stackoverflow.com/questions/134 ... -directory
leJOS news https://lejosnews.wordpress.com/

PXS710
New User
Posts: 4
Joined: Fri Jan 12, 2018 5:34 pm

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby PXS710 » Sat Jan 13, 2018 3:22 pm

gloomyandy wrote:jni.h is part of the Java SDK, you need to make sure your have the build options setup correctly...
https://stackoverflow.com/questions/134 ... -directory


Can you tell me how I'd do that? I entered the commands from that thread and they both gave me an error.

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby gloomyandy » Sat Jan 13, 2018 4:53 pm

Do you even have a Java SDK (not a Java JRE) installed on your Ubuntu system? Of so where is it, can you locate the jni.h file? Once you have done that you need to setup the environment to reference it as described in the thread I've already provided.
leJOS news https://lejosnews.wordpress.com/

PXS710
New User
Posts: 4
Joined: Fri Jan 12, 2018 5:34 pm

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby PXS710 » Tue Jan 16, 2018 6:13 pm

gloomyandy wrote:Do you even have a Java SDK (not a Java JRE) installed on your Ubuntu system? Of so where is it, can you locate the jni.h file? Once you have done that you need to setup the environment to reference it as described in the thread I've already provided.


I have it installed and I can find the file, it's in usr/lib/java/jdk-9/include. I'm sorry but I don't really understand the thread you linked. It says I have to add the JDK path to the include path, but what is the include path? When I enter the command from that thread into the terminal it just gives me an error:

pierce@pierce-VirtualBox:~/Downloads/leJOS_NXJ_0.9.1beta-3/build$ -I"${JAVA_HOME}/include"
bash: -I/usr/lib/java/jdk-9/include: No such file or directory

Telling me the directory doesn't exist even though I literally have that folder open so I don't know what I'm doing wrong :(

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby gloomyandy » Tue Jan 16, 2018 6:25 pm

Before we go any further, it looks like you are running Ubuntu inside a VirtualBox instance. Are you intending to try and run leJOS from that environment? If so why what is the host system that you have? Trying to get the leJOS USB interface working from a VM is almost certainly not a good idea especially given that you seem to be having problems getting things to compile.
leJOS news https://lejosnews.wordpress.com/

PXS710
New User
Posts: 4
Joined: Fri Jan 12, 2018 5:34 pm

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby PXS710 » Tue Jan 16, 2018 6:38 pm

gloomyandy wrote:Before we go any further, it looks like you are running Ubuntu inside a VirtualBox instance. Are you intending to try and run leJOS from that environment? If so why what is the host system that you have? Trying to get the leJOS USB interface working from a VM is almost certainly not a good idea especially given that you seem to be having problems getting things to compile.


I'm not intending to get the leJOS USB interface working from my virtual machine, the VM is for lejos development only and I'm going to upload the code with git and access it from another computer that can already interface with the NXT bot via USB.

To reiterate, I just need to be able to develop code on the VM (which I'm going to hopefully do with eclipse).

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: (Ubuntu) Ant trouble - jni.h: No such file or directory

Postby gloomyandy » Tue Jan 16, 2018 6:46 pm

In which case you probably do not need to build any of these native libraries! I would say though that you will be making your development process very cumbersome and you will lose the advantage of being able to use things like remote debugging and some of the other leJOS tools.
leJOS news https://lejosnews.wordpress.com/


Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 5 guests