1. download jdk8 and install.

  2. check java version:

    sodino:~ sodino$ java -version
    java version "1.8.0_45"
    Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
    
  1. find ‘java’ original path and ‘java_home’:

    sodino:~ sodino$ which java
    /usr/bin/java
    sodino:~ sodino$ ls -n /usr/bin/java
    lrwxr-xr-x  1 0  0  74 Sep 30  2014 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
    sodino:~ sodino$    /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home 
    /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
    
  2. get ‘include’ folder and jni.h

    now you will find a ‘include’ folder with in ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home’,
    and open it ‘jni.h’ will be found.