Ask Your Question

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

asked 2017-01-26 03:57:50 -0600

spacemoose gravatar image

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

    -isystem/usr/lib/jvm/java-1.8.0-openjdk- \
        -isystem/usr/lib/jvm/java-1.8.0-openjdk- \

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-26 05:56:36 -0600

fcomida gravatar image

That's already handled by the alternatives framework. You just have to include /usr/lib/jvm/java-1.8.0-openjdk/include. /usr/lib/jvm/java-1.8.0-openjdk is a symlink which goes into the alternatives system which, at the end, points to the right path in the filesystem (e.g. /usr/lib/jvm/java-1.8.0-openjdk-

edit flag offensive delete link more


Thanks, I went down the wrong path because when I did 'find /urs -name "jni.h"', only the version specific file was displayed, not the alternatives provided symlink.

spacemoose gravatar imagespacemoose ( 2017-01-31 01:47:19 -0600 )edit

Question Tools

1 follower


Asked: 2017-01-26 03:57:50 -0600

Seen: 42 times

Last updated: Jan 26 '17