node-java icon indicating copy to clipboard operation
node-java copied to clipboard

java_home must be exactly same with the developer's?

Open HarveyLee1228 opened this issue 1 year ago • 1 comments

Sorry for my bad English. I run into a problem when I using this tookit. When my project is packed,I can run it perfectly on my own device. But when my partner install the app built on my device, he cannot run it correctly. I have read the source code, it seems like the java_home dir from my device is hard coded into the output lib. How can I make the java_home dynamic reading from the user's device? 20240726152415286

HarveyLee1228 avatar Jul 26 '24 07:07 HarveyLee1228

I had the same problem. When compiling a C++ module, JAVA_HOME is set and it seems that it cannot be changed after that. So before compiling, I copied Java to the installation location and set the JAVA_HOME environment variable Since MacOS is installed in the application folder, I set it up as follows.

export JAVA_HOME=/Applications/builder_java.app/Contents/Resources/app.asar.unpacked/java_home

This is just a trick. If you know the normal way, please write below.

neolord0 avatar Feb 04 '25 09:02 neolord0