I have an application utilising jSerial which I've developed over time, but I have encountered an error seemingly related to jssc on transitioning it from Java 8 or OpenJDK 11 .
When run from the IDE, the application runs as expected and the serial port can be selected/opened and data received without error.
However on packaging it using B4JPackager, I receive the following in my log when I launch the application either via run.exe or run_debug.bat:
Java version: 11.0.1
Host Address: 192.168.0.3
BDSScoreboard V16_8 started at 8/1/2020 17:59:49
main._setuplocalforms (java line: -1)
java.lang.UnsatisfiedLinkError: Could not load the jssc library: Couldn't load library library jssc
at b4j/jssc.SerialNativeInterface.<clinit>(Unknown Source)
at b4j/jssc.SerialPortList.<clinit>(Unknown Source)
at b4j/anywheresoftware.b4j.serial.Serial.ListPorts(Unknown Source)
at b4j/b4j.example.main._setuplocalforms(Unknown Source)
at b4j/b4j.example.main._cmbdisplay_valuechanged(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
So why "Couldn't load library library jssc" when jssc.jar is in my additional libraries folder and in any case the application runs in the IDE?
When run from the IDE, the application runs as expected and the serial port can be selected/opened and data received without error.
However on packaging it using B4JPackager, I receive the following in my log when I launch the application either via run.exe or run_debug.bat:
Java version: 11.0.1
Host Address: 192.168.0.3
BDSScoreboard V16_8 started at 8/1/2020 17:59:49
main._setuplocalforms (java line: -1)
java.lang.UnsatisfiedLinkError: Could not load the jssc library: Couldn't load library library jssc
at b4j/jssc.SerialNativeInterface.<clinit>(Unknown Source)
at b4j/jssc.SerialPortList.<clinit>(Unknown Source)
at b4j/anywheresoftware.b4j.serial.Serial.ListPorts(Unknown Source)
at b4j/b4j.example.main._setuplocalforms(Unknown Source)
at b4j/b4j.example.main._cmbdisplay_valuechanged(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA$1.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
So why "Couldn't load library library jssc" when jssc.jar is in my additional libraries folder and in any case the application runs in the IDE?