B4J Question [Solved] jssc error with B4JPackager11

bdunkleysmith

Active Member
Licensed User
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?
 

bdunkleysmith

Active Member
Licensed User
I presumed that the jssc.jar contained in the current version (1.31) of the jSerial library would be the correct one, but I replaced it with the jssc.jar from this post even though it pre-dates release of the latest version of jSerial. The jssc.jar in that library archive may be OK for other platforms, but it seems @techknight's is required for OpenJDK11 under Windows 10 64 bit.

As we are reminded in this post, "you MUST go into your windows user profile folder and delete the cache .jssc folder", ie. C:\Users\'username'\.jssc\windows\ folder.
 

wcieslik

Member
Licensed User
Thanks Man !
That did the trick !
I didn't want to replace it as it was smaller and older than the one I originally swapped in, just to get Serial working ...
but yeah... the 189Kb one works
Thanks again .
 
Top