1

I'm trying to install glpk for java and have followed the instructions for installing glpk on OS X here until ./configure. During this step, the error configure: error: jni.h not found appears. As the instruction states, I tried

./configure \
CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers \
SWIGFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers

but it doesn't seem to work, since the same error still comes up. After doing some digging, I found out: - I don't have a JavaVM.framework within the Frameworks folder - Instead, my Java VMs are in Library/Java/JavaVirtualMachines/

So I tried executing

./configure \
CPPFLAGS=-I/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/include/ \
SWIGFLAGS=-I/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/include/

I also tried it with .../include/jni.h and with jdk-12.0.1.jdk. All resulting in the same error.

I'm a newbie to those things, so I would be very thankful for a hint to anything I could try.

Nanda
  • 51
  • 1
  • 6

1 Answers1

0

You may check the configure.log file. In my configure.log file, it shows:

configure:13062: gcc -E  -I/usr/bin/java/include -I/usr/bin/java/include/linux conftest.c
cc1: error: /usr/bin/java/include: Not a directory
cc1: error: /usr/bin/java/include/linux: Not a directory
configure:13062: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GLPK for Java"
| #define PACKAGE_TARNAME "libglpk-java"
| #define PACKAGE_VERSION "1.12.0"
| #define PACKAGE_STRING "GLPK for Java 1.12.0"
| #define PACKAGE_BUGREPORT "xypron.glpk@gmx.de"
| #define PACKAGE_URL "http://glpk-java.sourceforge.net"
| #define PACKAGE "libglpk-java"
| #define VERSION "1.12.0"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define TLS /**/
| /* end confdefs.h.  */
| #include <glpk.h>
configure:13062: result: no
configure:13062: checking for glpk.h
configure:13062: result: no
configure:13066: error: glpk.h not found

I found that my JAVA_HOME is not set up properly. From this question (How to set JAVA_HOME in Linux for all users):

readlink -f $(which java)
##I got
#/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64/jre/bin/java

##Then I set the JAVA_HOME
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64"

Then ./configure. It works for me.

wutao
  • 54
  • 4