configure: error: *** Cannot find jni.h - check your JDK installation ***

Started by depierce, December 08, 2015, 03:15:23 AM

Previous topic - Next topic

depierce

Having a tough time figuring out how to get configure to see my JDK install.  Tried below with --includedir=/usr/lib/jvm/java-8-oracle as well.
Edit: This is trying to build netxms-2.0-RC2 on Ubuntu 12.04.5 with Oracle's Java SDK version 1.8 installed.

sh ./configure --prefix=/opt/netxms --with-server --with-snmp --with-client --with-client-proxy --with-agent --disable-ipv6 --with-jdk --with-mysql --with-openssl --with-gnu-ld
...
configure: error: *** Cannot find jni.h - check your JDK installation ***

java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

DERBY_HOME=/usr/lib/jvm/java-8-oracle/db
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/lib/jvm/java-8-oracle/include
JAVA_HOME=/usr/lib/jvm/java-8-oracle
J2SDKDIR=/usr/lib/jvm/java-8-oracle
J2REDIR=/usr/lib/jvm/java-8-oracle/jre

UPDATE/SOLVE:
On a hunch that configure needs gcj glue to "find" java headers, went ahead and installed java-gcj-compat-headless and java-gcj-compat-dev and all dependencies.  Configure works now.

Victor Kirhenshtein

Hi,

alternatively, you can specify JDK location in --with-jdk parameter, like this:

./configure --with-jdk=/usr/lib/jvm/java-7-openjdk-amd64

JDK location varies between distributions, this example is from Deian/Ubuntu.

Best regards,
Victor

depierce

Hi, Victor.

Actually I tried specifying with --with-jdk /usr/lib/jvm/java-8-oracle and also appending /include to path - neither worked.  Don't know if it's a limitation of the configure function to check java version but installing the gjc packages did the trick.