I have a makefile, which needs to know the location of the Java include directory because it makes use of the jni.h file. What is the best way of allowing the Makefile to auto-detect where Java is installed on Linux?
Thanks,
Chris
How about using
JAVA_HOME=$(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")
Adapted from: https://serverfault.com/questions/143786/how-to-determine-java-home-on-debian-ubuntu
You can try this too:
JAVA_HOME:=$(jrunscript -e 'java.lang.System.out.println(new java.io.File(java.lang.System.getProperty("java.home")).getParent());')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With