Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to install Java native development headers on OS X Lion
    primarykey
    data
    text
    <p>I'm trying to build a JNI project, but I can't seem to find the JNI headers (e.g. <code>jni.h</code>). I've installed "Java for Mac OS X 10.7 Developer Package" from <a href="https://developer.apple.com/downloads/">https://developer.apple.com/downloads/</a>.</p> <p>Various online resources suggest the headers should be in locations such as <code>/System/Library/Frameworks/JavaVM.framework/Headers</code> or <code>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include</code>, but I can't find them anywhere -- the installer doesn't seem to be creating them.</p> <p>I see other JDK components -- just for example, <code>/System/Library/Frameworks/JavaVM.framework/Commands/javah</code> -- but not the JNI headers. Any suggestions?</p> <hr> <p>Update: technomage pointed out that Apple now installs the JDK under <code>/Library/Java/JavaVirtualMachines</code>, and the JNI headers were at <code>/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/include/jni.h</code>. </p> <p>But I'm still stuck on my actual goal, which is to build the JNI wrappers for LevelDB (per instructions at github.com/fusesource/leveldbjni). To point Maven at the proper JDK, I added <code>/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin</code> to the front of my PATH, and set JAVA_HOME to <code>/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home</code>. After chugging for a while, Maven now fails with:</p> <pre><code>[INFO] --- maven-hawtjni-plugin:1.5:build (default) @ leveldbjni-osx --- [INFO] Extracting /Users/steve/leveldb/leveldbjni/leveldbjni/target/leveldbjni-99-master-SNAPSHOT-native-src.zip to /Users/steve/leveldb/leveldbjni/leveldbjni-osx/target/native-build-extracted [INFO] executing: /bin/sh -c ./configure --disable-ccache --prefix=/Users/steve/leveldb/leveldbjni/leveldbjni-osx/target/native-build/target --with-leveldb=/Users/steve/leveldb/leveldb --with-snappy=/Users/steve/leveldb/snappy-1.0.3 --with-universal --with-leveldb=/Users/steve/leveldb/leveldb --with-snappy=/Users/steve/leveldb/snappy-1.0.3 ... [INFO] configure: JAVA_HOME was set, checking to see if it's a JDK we can use... [INFO] checking if '/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home' is a JDK... no [INFO] configure: javac was on your path, checking to see if it's part of a JDK we can use... [INFO] checking if '/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home' is a JDK... no [INFO] configure: Taking a guess as to where your OS installs the JDK by default... [INFO] checking if '/System/Library/Frameworks/JavaVM.framework' is a JDK... no [INFO] configure: error: JDK not found. Please use the --with-jni-jdk option </code></pre> <p>I can't tell for sure what Maven is looking at to identify "a JDK we can use"? Some digging around led me to <a href="http://www.arm4.org/trac/browser/branches/architecture/m4/jni.m4">http://www.arm4.org/trac/browser/branches/architecture/m4/jni.m4</a> which appears to look for jni.h in a few places and try to compile it, but I don't know whether this jni.m4 has any actual relationship Maven. I do have jni.h in /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/include/.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload