I am attempting to install the CLIPS JNI-based IDE in Linux (Raspberry Pi / Debian) and keep getting the infamous error message:
fatal error: jni.h: No such file or directory #include <jni.h> </jni.h>
On my Raspberry PI, Java works fine - I can run regular java programs. I suspect the problem has something to do with my environment variables, which I have set up in the bashrc file like so:
$JAVA_HOME resolves to: /usr/lib/jvm/java-11-openjdk-armhf/ and the jni.h file is plainly visible in the above path $JAVA_HOME/include.
Per the the CLIPS interface guide (7.6.3), I navigate to the CLIPSJNI/library-src directory and then execute:
make -f makefile.lnx debian
which produces the error message.
Any ideas for a fix greatly appreciated. Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The makefile sets JAVA_HOME to /usr/lib/jvm/default-java for debian. If that’s not resolving to the correct directory where the include file containing jni.h is located, try changing the path in the makefile and see if that works correctly.
I am attempting to install the CLIPS JNI-based IDE in Linux (Raspberry Pi / Debian) and keep getting the infamous error message:
fatal error: jni.h: No such file or directory #include <jni.h> </jni.h>
On my Raspberry PI, Java works fine - I can run regular java programs. I suspect the problem has something to do with my environment variables, which I have set up in the bashrc file like so:
$JAVA_HOME resolves to: /usr/lib/jvm/java-11-openjdk-armhf/ and the jni.h file is plainly visible in the above path $JAVA_HOME/include.
Per the the CLIPS interface guide (7.6.3), I navigate to the CLIPSJNI/library-src directory and then execute:
make -f makefile.lnx debian
which produces the error message.
Per your suggestion I changed this line in the make file:
debian : JAVA_HOME = /usr/lib/jvm/default-java
to this:
debian : JAVA_HOME = /usr/lib/jvm/java-11-openjdk-armhf/
I redid the 7.6.3 instructions. I jumped back to 7.3 to run the clips JNI, but after running java -Djava.library.path=. –jar CLIPSJNI.jar from the CLIPSJNI directory, I received the following error message:
Error: Could not find or load main class –jar
Caused by: java.lang.ClassNotFoundException: –jar
I saw some posts on the internet somewhat related to this error message, and tried to add a CLASSPATH in my bashrc file (4th one down):
export PATH=$PATH:/home/pi/.local/bin/:/home/pi/Documents/CLIPScore/core/
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf/
export PATH=$JAVA_HOME/bin/:$JAVA_HOME/include/:$PATH
export CLASSPATH=$JAVA_HOME/include/
but I am still coming up with the same " Error: could not find .... -jar " message. I have to admit I'm a little out of my depth here, but the good news is that I have CLIPS running beautifully on both my Windows and Mac OSx machines. In addition, CLIPS runs on my Rpi in command mode. If you want me to try out a few other strategies on my Rpi for the good of the order, I'd be happy to do so, but for my own purposes (learn CLIPSs) I'm in good shape.
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use parallels on my iMac to run Windows and five different flavors of Linux (Ubuntu, Fedora, CentOS, Debian, and Mint). Other than installing a few applications and the JDK, the Linux installs are otherwise unmodified. I haven't done any modifications in my bashrc to change the PATH, CLASSPATH, etc. I'm not an expert on the ins and outs of how java locates jar files, but at least the directory in which your jar file is located needs to be on the classpath. I'm not sure why the current directory wouldn't already be on the classpath, but instead of adding it to your bashrc, try adding the option -cp . when you try to launch the jar file: java -cp . -Djava.library.path=. –jar CLIPSJNI.jar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An interesting sign of the times: I made heavy use of ChatGPT which sent me in a number of wrong directions over the last couple of days on this. But the key to making it helpful was to give it the names of key directories and jar files, so that its responses were more pointed. Once it had reached that point of familiarity, my final question was this:
ME: So if i were in the CLIPSJNI directory would I execute:
java -Djava.library.path=. -jar CLIPSJNI.jar ?
ChatGPT: If you are already in the CLIPSJNI directory, then you can use the following command to run the CLIPSIDE program:
java -Djava.library.path=. -jar CLIPSIDE.jar
At that point I noticed the JNI vs. IDE thing. It would have helped if ChatGPT, realizing that I am human and that it is late at night, would have prefaced its response with 'Hell, No! That's wrong!'
Best regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should be able to run both. Specifying CLIPSJNI.jar should launch CLIPS within the terminal as a console application whereas specifying CLIPSIDE.jar should launch the IDE with the multiple document interface.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am attempting to install the CLIPS JNI-based IDE in Linux (Raspberry Pi / Debian) and keep getting the infamous error message:
fatal error: jni.h: No such file or directory #include <jni.h> </jni.h>
On my Raspberry PI, Java works fine - I can run regular java programs. I suspect the problem has something to do with my environment variables, which I have set up in the bashrc file like so:
export PATH=$PATH:/home/pi/.local/bin/:/home/pi/Documents/CLIPScore/core/
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf/
export PATH=$JAVA_HOME/bin/:$JAVA_HOME/include/:$PATH
$JAVA_HOME resolves to: /usr/lib/jvm/java-11-openjdk-armhf/ and the jni.h file is plainly visible in the above path $JAVA_HOME/include.
Per the the CLIPS interface guide (7.6.3), I navigate to the CLIPSJNI/library-src directory and then execute:
make -f makefile.lnx debian
which produces the error message.
Any ideas for a fix greatly appreciated. Dave
The makefile sets JAVA_HOME to /usr/lib/jvm/default-java for debian. If that’s not resolving to the correct directory where the include file containing jni.h is located, try changing the path in the makefile and see if that works correctly.
Cheers,
Gary
Per your suggestion I changed this line in the make file:
debian : JAVA_HOME = /usr/lib/jvm/default-java
to this:
debian : JAVA_HOME = /usr/lib/jvm/java-11-openjdk-armhf/
I redid the 7.6.3 instructions. I jumped back to 7.3 to run the clips JNI, but after running java -Djava.library.path=. –jar CLIPSJNI.jar from the CLIPSJNI directory, I received the following error message:
Error: Could not find or load main class –jar
Caused by: java.lang.ClassNotFoundException: –jar
I saw some posts on the internet somewhat related to this error message, and tried to add a CLASSPATH in my bashrc file (4th one down):
export PATH=$PATH:/home/pi/.local/bin/:/home/pi/Documents/CLIPScore/core/
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf/
export PATH=$JAVA_HOME/bin/:$JAVA_HOME/include/:$PATH
export CLASSPATH=$JAVA_HOME/include/
but I am still coming up with the same " Error: could not find .... -jar " message. I have to admit I'm a little out of my depth here, but the good news is that I have CLIPS running beautifully on both my Windows and Mac OSx machines. In addition, CLIPS runs on my Rpi in command mode. If you want me to try out a few other strategies on my Rpi for the good of the order, I'd be happy to do so, but for my own purposes (learn CLIPSs) I'm in good shape.
Dave
I use parallels on my iMac to run Windows and five different flavors of Linux (Ubuntu, Fedora, CentOS, Debian, and Mint). Other than installing a few applications and the JDK, the Linux installs are otherwise unmodified. I haven't done any modifications in my bashrc to change the PATH, CLASSPATH, etc. I'm not an expert on the ins and outs of how java locates jar files, but at least the directory in which your jar file is located needs to be on the classpath. I'm not sure why the current directory wouldn't already be on the classpath, but instead of adding it to your bashrc, try adding the option -cp . when you try to launch the jar file: java -cp . -Djava.library.path=. –jar CLIPSJNI.jar
This story has a happy ending. It turns out that instead of typing:
..... CLIPSJNI $ java -Djava.library.path=. -jar CLIPSJNI.jar
shown in 7.6.3 of the Interfaces Guide, one should type:
..... CLIPSJNI $ java -Djava.library.path=. -jar CLIPSIDE.jar
(CLIPSIDE, not CLIPSJNI)
An interesting sign of the times: I made heavy use of ChatGPT which sent me in a number of wrong directions over the last couple of days on this. But the key to making it helpful was to give it the names of key directories and jar files, so that its responses were more pointed. Once it had reached that point of familiarity, my final question was this:
ME: So if i were in the CLIPSJNI directory would I execute:
java -Djava.library.path=. -jar CLIPSJNI.jar ?
ChatGPT: If you are already in the CLIPSJNI directory, then you can use the following command to run the CLIPSIDE program:
java -Djava.library.path=. -jar CLIPSIDE.jar
At that point I noticed the JNI vs. IDE thing. It would have helped if ChatGPT, realizing that I am human and that it is late at night, would have prefaced its response with 'Hell, No! That's wrong!'
Best regards
You should be able to run both. Specifying CLIPSJNI.jar should launch CLIPS within the terminal as a console application whereas specifying CLIPSIDE.jar should launch the IDE with the multiple document interface.