You did inquire about several paths, and I've tried them all. Here they are summarized:
'Begin Summary
Erel: Have you ran the jar file that is in the app folder? You should run it from the command line and see the error message.
nib: Yes, it runs fine - there is no error message
Erel:
1. Show a msgbox with the error and return false from Application_Error.
2. Run it as an administrator.
nib:
1) no Application Error appears and the packaged program crashes on Serial port open
2) Ran as administrator and the packaged program crashes on Serial port open
Erel:
Please add this code:
osName = ${GetSystemProperty.....
.... "$
fx.Msgbox(MainForm, s, "")
nib:
Added the code, and it gives predictable information,
osName = Windows 10
architecture = amd64
userHome = C:\Users\Michael
fileSeperator = \
tmpFolder = C:Users\Michael\AppData\Local\Temp\
Erel: Is there any difference in the result when you run it with java -jar compared to running the executable?
nib: it runs fine with java -jar - no error messages
'End Summary
I found that the problem appears even when using this websites own Chat program, which can be found here
https://www.b4x.com/android/forum/threads/jserial-library.34762/#content
when packaged using this website's self contained installer which can be found here
https://www.b4x.com/android/forum/threads/ui-apps-packaging-self-contained-installers.56854/#content
it crashes on Serial port open
To capture the error, I added logError and LastException in the existing program subroutine, btnOpen_Action,
Try
sp.Open(cmbPort.Value)
Catch
LogError(LastException.Message)
End Try
It crashed on Serial port open, reporting excerpt:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=12512, tid=0x0000000000003244
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [jSSC-2.8_x86_64.dll+0xb5db]
#
........
........
Stack: [0x0000000b86800000,0x0000000b86900000], sp=0x0000000b868fd3c0, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [jSSC-2.8_x86_64.dll+0xb5db]
C [jSSC-2.8_x86_64.dll+0x12590]
C [jSSC-2.8_x86_64.dll+0x1595]
C 0x000001f6318e925b
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j jssc.SerialNativeInterface.openPort(Ljava/lang/String;Z)J+0
j jssc.SerialPort.openPort()Z+65
j anywheresoftware.b4j.serial.Serial.Open(Ljava/lang/String
V+16
j b4j.example.main._btnopen_action()Ljava/lang/String;+201
v ~StubRoutines::call_stub
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object
Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object
Ljava/lang/Object;+100
J 1189 C1 sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object
Ljava/lang/Object; (10 bytes) @ 0x000001f631ceac44 [0x000001f631ceab40+0x104]
J 1188 C1 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object
Ljava/lang/Object; (62 bytes) @ 0x000001f631ce98ac [0x000001f631ce94c0+0x3ec]
j anywheresoftware.b4a.BA.raiseEvent2(Ljava/lang/Object;ZLjava/lang/String;Z[Ljava/lang/Object
Ljava/lang/Object;+76
j anywheresoftware.b4a.BA$1.run()V+18
j com.sun.javafx.application.PlatformImpl.lambda$null$173(Ljava/lang/Runnable
Ljava/lang/Void;+1
j com.sun.javafx.application.PlatformImpl$$Lambda$52.run()Ljava/lang/Object;+4
v ~StubRoutines::call_stub
J 1550 java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext
Ljava/lang/Object; (0 bytes) @ 0x000001f631dac4a6 [0x000001f631dac440+0x66]
j com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Ljava/lang/Runnable;Ljava/security/AccessControlContext
V+7
j com.sun.javafx.application.PlatformImpl$$Lambda$50.run()V+8
j com.sun.glass.ui.InvokeLaterDispatcher$Future.run()V+4
v ~StubRoutines::call_stub
j com.sun.glass.ui.win.WinApplication._runLoop(Ljava/lang/Runnable
V+0
j com.sun.glass.ui.win.WinApplication.lambda$null$148(ILjava/lang/Runnable
V+8
j com.sun.glass.ui.win.WinApplication$$Lambda$40.run()V+12
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub