-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node Java doesn't work on different Platforms of OSX #413
base: master
Are you sure you want to change the base?
Conversation
The readme change is fine but the path problem should be fixed in the https://www.npmjs.com/package/find-java-home project. |
Forgive me for my possible ignorance here, but I am unclear how any changes to find-java-home can address the underlying problem that nodejavabridge_bindings have a static path to the JVM on the build machine embedded in them. The path is correct on the machine which the native code is initially compiled on, but the path is embedded in the binary. If / when you move the binary to another machine, the path isn't guaranteed to even exist there. Is find-java-home what allows the Windows binaries to use the Registry to accurately identify the installed java path regardless of where it is built? |
@jsdevel did most of the work integrating find-java-home, so I'm not 100% sure if this is the correct solution, but I saw replacing |
OSX used to be bundled with java. This made it pretty simple to find. Oracle's acquisition of Java hasn't been very helpful. This is a pretty good answer to where Java can be installed: On a particular system, there is a convenience script similar to the registry: /Library/Application Support/ExportData is a arbitrary location that we created for an app we were working on (ExportData). The Application Support directory is similar to AppData in Windows. javaLocation is a symbolic link which points to the location of the desired JVM you wish to use. The client, or an installer would have to create this link. If you wish to incorporate this into your codebase, you might consider changing the link location to /Library/Application Support/NodeJava/ |
The primary issue with Node-Java on OSX is that the path to the Java SDK is embedded in the compiled code. This used to be OK in OSX, but the most recent versions of OSX no longer bundle Java. Users have to manually install it, and may have different versions in different locations.
This means after the code is built, Java is not necessarily accessible in the fixed location provided with the build. A solution (included in this pull request) is to compile with a link to the version of Java you wish to use. The link needs to be defined (currently in /Library/Application Support/ExportData/) which is probably not ideal. Could easily be modified to something like /Library/Application Support/node-java/.