B4J Question B4j standalone package fails to run

gpa

Member
Licensed User
Longtime User
Hi...
My app runs fine from B4j, and if I use the inbuilt "standalone package" generator it completes without error.
However - double clicking the exe fails.
So, trying run_debug.bat I get the error below.
Looks like there is a library ref missing but I'm not sure why or how to ensure it's added?
Any help appreciated!

Thanks...

B4X:
C:\Temp\jSourceCode\bridge\Objects\temp\build\bin>java.exe @release_java_modules.txt  -m b4j/b4j.example.main
main._appstart (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._appstart(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.raiseEvent(Unknown Source)
        at b4j/b4j.example.main.start(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(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)


C:\Temp\jSourceCode\bridge\Objects\temp\build\bin>pause
Press any key to continue . . .
 

Dadaista

Active Member
Licensed User
Longtime User
 
Upvote 0

gpa

Member
Licensed User
Longtime User
Thanks! That works!
But....
Hmm... That jssc.jar file works - but I it's a bit of an odd solution - in the sense that I'd really like to know why an older, much smaller, jar file works where the "official" one doesn't - and only in the non IDE setting. In my case there was also no transition from Win7 or Java 8 as discussed in the post...
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
While the method used at that reference solved the problem at that time, the "correct" way when using the Integrated B4JPackager11 is to follow Tips and special cases #5 in this post Integrated B4JPackager11 - The simple way to distribute standalone UI apps, ie.:

5. If using jSerial put the attached jssc.dll file in the project folder and add:

B4X:
#CustomBuildAction: After Packager, %WINDIR%\System32\robocopy.exe, ..\ temp\build\bin\ jssc.dll
 
Upvote 0

gpa

Member
Licensed User
Longtime User
Sigh. I missed that, and had read that page... But it is an odd instruction - the custom build action attempts to copy it from win sys32 folder - where there is no such file, and the instruction says to put in in the project folder... Might make sense if building the package moved it to win sys32 but it doesn't - not on my machine anyway!
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Perhaps you are misreading the instruction as the reference to System32 is where robocopy.exe located and which is used to copy jssc.dll from ..\ to temp\build\bin\

This resolution when using jSerial (and thus jssc.dll) was first posted here and then added to the list of Tips and special cases for the integrated packager.

Based on my experience, it works perfectly when the instructions are followed
 
Upvote 0

gpa

Member
Licensed User
Longtime User
Ah - you are right - on a quick scan I didn't spot that vital space in the command line!
Ah well, at least I'm not the only one who missed that bit in the post anyway!
Thanks...
 
Upvote 0
Top