You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macos electron use node-java-bridge, macos electron use node-java-bridge ,error: Uncaught Exception: Error: java.lang.ClassNotFoundException: io.github.markusjx.bridge.NativeLibrary #111
I used 'node java' in 'electron' and after packaging DMG, the button triggered the connection to 'jar', but an error occurred
err:
chunk-libs.befb8490.js:67 Error: Error invoking remote method 'handle-jar': Error: java.lang.ClassNotFoundException: io.github.markusjx.bridge.NativeLibrary
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at crates/java-rs/src/j…_env_wrapper.rs:765
at crates/java-rs/src/j…_env_wrapper.rs:323
at EventEmitter.i.invoke (node:electron/js2c/renderer_init:57:526)
at async i.handleJar (chunk-2e62c82d.7c30320e.js:1:68842)
chunk-dc348ffc.858acd80.js:1
Hi. I am getting the same error when trying out java-bridge 2.8.0 in an Electron application on a Windows x64 platform. I have, as advised the configuration:
for asarUnpack and also used isPackagedElectron set to true. It seems to load the JVM and also finds the native module, but fails to include JavaBridge.jar. When investigating, I noted that in this PR: 001b5aa
the parameter isPackagedElectron was removed from getJavaLibPath but it is still used in the other calls in nativeLib.ts but when using 'node_modules/java-bridge/**' in asarUnpack the JAR file will be unpacked as well.
So, shouldn't the regex workaround for asar also be used for the JAR?
Activity
MarkusJx commentedon Mar 21, 2025
You may want to try setting
isPackagedElectrontotruewhen callingensureJVM, before calling any other methods of this package.fmannhardt commentedon Sep 29, 2025
Hi. I am getting the same error when trying out java-bridge 2.8.0 in an Electron application on a Windows x64 platform. I have, as advised the configuration:
for
asarUnpackand also usedisPackagedElectronset totrue. It seems to load the JVM and also finds the native module, but fails to include JavaBridge.jar. When investigating, I noted that in this PR:001b5aa
the parameter
isPackagedElectronwas removed fromgetJavaLibPathbut it is still used in the other calls innativeLib.tsbut when using'node_modules/java-bridge/**'inasarUnpackthe JAR file will be unpacked as well.So, shouldn't the regex workaround for asar also be used for the JAR?
fmannhardt commentedon Sep 29, 2025
I just downgraded to v2.4.0 (before the changes mentioned above) and it works fine in Electron. So, I assume the change in 001b5aa caused the issue.
MarkusJx commentedon Feb 21, 2026
Could be fixed by #118
MarkusJx commentedon Feb 22, 2026
Should be fixed in v2.8.1