GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Mavericks Issue? · Issue #86 · joeferner/node-java

Mavericks Issue? #86

New issue
Copy link
New issue
Copy link
Closed
Closed
Mavericks Issue?#86
Copy link

Description

@xjamundx
xjamundx
opened on Nov 11, 2013
Issue body actions

I'm not a Java expert, but I am having this issue.

~/dev $ npm install [email protected]
npm http GET http://npm.paypal.com/java/0.2.7
npm http 200 http://npm.paypal.com/java/0.2.7
npm http GET http://registry.npmjs.org/java/-/java-0.2.7.tgz
npm http 200 http://registry.npmjs.org/java/-/java-0.2.7.tgz

> [email protected] install /Users/jamuferguson/dev/node_modules/java
> node-gyp rebuild

  CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
In file included from ../src/java.cpp:2:
../src/java.h:7:10: fatal error: 'jni.h' file not found
#include <jni.h>
         ^
1 error generated.
make: *** [Release/obj.target/nodejavabridge_bindings/src/java.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jamuferguson/dev/node_modules/java
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Here is my version number and stuff

~/dev $ which java
/usr/bin/java
~/dev $ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Activity

  1. inolen commented on Nov 12, 2013

    @inolen
    inolen
    on Nov 12, 2013
    Contributor
    More actions

    Seems like perhaps JAVA_HOME may not being discovered properly. I'd try manually setting that, and if that still doesn't work, mucking with binging.gyp line ~130 until you can resolve the issue.

  2. kevinrc commented on Nov 12, 2013

    @kevinrc
    kevinrc
    on Nov 12, 2013
    More actions

    I was having the same issue as Jamund and I've managed to work around it. The solution seems to be setting the JAVA_HOME env variable. I also updated to 1.7.0_45 but I'm not sure that had any effect on finding the solution.

  3. apowers313 commented on Nov 12, 2013

    @apowers313
    apowers313
    on Nov 12, 2013
    More actions

    I'm on Mavericks with the same version of Java and haven't seen this issue and can't reproduce it by unsetting or changing JAVA_HOME.

  4. xjamundx commented on Nov 13, 2013

    @xjamundx
    xjamundx
    on Nov 13, 2013
    Author
    More actions

    In case anyone else has the problem. I did the following.

    1. Installed newest Java from http://java.com/en/download/mac_download.jsp
    2. export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/
    3. npm install java

    See: http://stackoverflow.com/questions/9704376/how-to-install-java-native-development-headers-on-os-x-lion for a reference

    Reacted by Abanob Mikaeel and Erhan Güney
    Reacted by Erhan Güney
  5. xjamundx
    closed this as completedon Nov 13, 2013
  6. kevinrc commented on Nov 14, 2013

    @kevinrc
    kevinrc
    on Nov 14, 2013
    More actions

    In talking with a few other folks who have Mavericks and did not have this issue, it appears that if you had 1.7.0_45 before upgrading to Mavericks the issue doesn't appear. After Mavericks the JDK installer no longer appears to update the current_jdk link. So, the only way to solve the issue is to set JAVA_HOME or update the link to point to the latest JDK.

  7. joeferner
    added a commit that references this issue on Nov 14, 2013

    Added link to issue #86 for Mavericks users

    18fbc53
  8. loretoparisi commented on Dec 6, 2016

    @loretoparisi
    loretoparisi
    on Dec 6, 2016
    More actions

    @kevinrc I'm having this error on macOS Sierra and idk 1.8, did you experienced it on recent models of MPB and java8?

    Reacted by Jamie Diprose and Jiaju
  9. nselikoff commented on Jul 26, 2017

    @nselikoff
    nselikoff
    on Jul 26, 2017
    More actions

    I was experiencing a similar issue, although the file that couldn't be found was jni_md.h. Turns out, if you're using jenv (https://github.com/gcuisinier/jenv), because it uses a shim and symlink for JAVA_HOME, node-java will resolve the path to "Users" not "Library" and therefore won't include the extra darwin subdirectory (where jni_md.h is located).

    Reacted by Xiaojun Ren and Jascha Ephraim
  10. nicholasren commented on Sep 19, 2017

    @nicholasren
    nicholasren
    on Sep 19, 2017
    More actions

    I'm using jenvand run into the exactly same problem @nselikoff mentioned above.
    My current workaround is copy jni_md.h and jawt_md.h from <JDK_HOME>/Contents/Home/include/darwin to <JDK_HOME>/Contents/Home/include and run npm install java

    Reacted by yaojie, Jascha Ephraim and Javier García Valdepeñas
  11. parminder7 commented on Jun 13, 2018

    @parminder7
    parminder7
    on Jun 13, 2018
    More actions

    @nicholasren I am also using jenv and tried your recommended solution, but I am still getting

    ../src/java.h:7:10: fatal error: 'jni.h' file not found
    #include <jni.h>
    

    error. What do you suggest to do next?

  12. paulwcy commented on Jun 19, 2018

    @paulwcy
    paulwcy
    on Jun 19, 2018
    Contributor
    More actions

    I'm using jenv as well...
    Setting JAVA_HOME worked for me
    export JDK_HOME=$(/usr/libexec/java_home -v 1.8)

  13. mustafabutt-dev commented on Jan 8, 2024

    @mustafabutt-dev
    mustafabutt-dev
    on Jan 8, 2024
    More actions

    I am also facing this issue with the following specs:
    node --version
    v21.1.0

    java version "1.8.0_381"
    Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
    Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)

    npm ERR! ../src/java.h:7:10: fatal error: 'jni.h' file not found
    npm ERR! #include <jni.h>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.