Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

canonical way to specify path to java includes from C or C++?

I build a project which includes jni.h and jni_md.h. I have modified the Makefiles to specify the include path, so that these are found by the build system, i.e. I've added

CXXFLAGS = ...\
    -isystem/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-5.b16.fc25.x86_64/include/ \
        -isystem/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-5.b16.fc25.x86_64/include/linux/ \
         ...

But of course, every time the openjdk-devel package gets an update the path changes, and I have to adjust the file. If I'm building on different versions of fedora I have even more headaches.

Is there a canonical or best way to handle this? Some way to have the path update automatically when the package is updated?