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

Distributing an electron app with node-java is not maintainable

Open antoinepairet opened this issue 8 years ago • 1 comments

Distributing an electron app with node-java is not maintainable Because the JVM path is bound to a specific version of JAVA.

Is there a way to have LC_RPATH resolved at runtime?

Using otool -l nodejavabridge_bindings.node (full output: otool_-l.txt) I see in the output that the path to the JVM is harcoded to a specific version:

Load command 11
          cmd LC_RPATH
      cmdsize 96
         path /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/server (offset 12)

Using otool -L:

        @rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 915.0.0)

Workarounds exists:

  • create a symbolic link pointing to the JVM running on the machine

antoinepairet avatar Oct 18 '16 22:10 antoinepairet

@antoinepairet "create a symbolic link pointing to the JVM running on the machine" so you mean create a link on the machine you build with like '/usr/local/java' points to '/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk' and then you just need to have the user create the link after installing your electron app? and the bindings are ok so long as the user's jdk supports that compatibility version?

gpinkham avatar Apr 30 '19 22:04 gpinkham