B4J Question JavaObject.InitializeStatic throws java.lang.ClassNotFoundException in Release Mode but not in Debug Mode

Similar threads

B4J Code Snippet Redirect the output to a file
B4J Code Snippet [B4X] Trust all SSL Socket
B4J Code Snippet Get Image Pixels
B4J Code Snippet Find user documents folder
B4J Tutorial [Server] Screen capture server

Tobias Leininger

Member
Licensed User
This code creates the following error in Release Mode but not in Debug Mode:

Error:
java.lang.ClassNotFoundException: org$bytedeco$javacv$Frame

(The jar files are included in the Main Module with #AdditionalJar)

Class Module:
Sub Class_Globals
    Private Frame As JavaObject
End Sub

Public Sub Initialize
    Frame.InitializeStatic("org.bytedeco.javacv.Frame")
End Sub
It's probably a noob error but any ideas what I'm doing wrong here?
It works perfectly fine in Debug Mode.

Full Error:
java.lang.ClassNotFoundException: org$bytedeco$javacv$Frame
at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:289)
at anywheresoftware.b4j.object.JavaObject.InitializeStatic(JavaObject.java:75)
at tt.hps3dprocessorui.realsense._initialize(realsense.java:201)
at tt.hps3dprocessorui.main._appstart(main.java:92)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at tt.hps3dprocessorui.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
 

Tobias Leininger

Member
Licensed User
I would think so too, but it's included and works in Debug Mode but not in Release Mode for some reason.

I'm also confused as it shows $ instead of . in the error message:
org$bytedeco$javacv$Frame vs org.bytedeco.javacv.Frame
 

Tobias Leininger

Member
Licensed User
So I tried many different versions and got it working by only including some of the libraries.

I'm not really familiar with Java, but it looks like they load the platform specific libraries on runtime in JavaCV and that somehow doesn't work correctly.
Now I've only included the library for one platform directly for each dependency and that works.

What is the difference in Debug Mode vs. Release Mode related to included JARs that makes the behavior so different between the two?
 
Top