B4J Question Sqlite DB in B4Xpages Error java.lang.RuntimeException: Class not found: ..... Are you missing an #AdditionalJar attribute setting?

Kevin Hartin

Active Member
Licensed User
This is my first try at B4X pages so I thought I'd port over an app that I have working on both B4A and B4I.

As recomended in the Tutorial, I started with B4J and then added the necessary conditional code to handle the differences between platforms. It compiles in both B4a and B4i, but doesn't run and on B4J it runs and throws an error as per above when I try to initialise the DB.

I have #AdditionalJar: sqlite-jdbc-3.32.3.2 in Main-#Region Project Attributes and the file exists in my additional libraies folder. I am using Dir.Data as the place where the DB is put and it is certainly copying the file from Dir.Assets as I can see it in the C:\Users\kevin\AppData\Roaming\RADcalc folder.
1615793697055.png

The full error is as follows;
B4X:
Waiting for debugger to connect...
Program started.
SQLDataBasePath: C:\Users\kevin\AppData\Roaming\RADcalc
SQLDateBaseName: RAD.db
Error occurred on line: 200 (B4XMainPage)
java.lang.RuntimeException: Class not found: C:\Users\kevin\AppData\Roaming\RADcalc
Are you missing an #AdditionalJar attribute setting?
    at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:56)
    at anywheresoftware.b4j.objects.SQL.Initialize(SQL.java:47)
    at b4j.example.b4xmainpage._initialize(b4xmainpage.java:1210)
    at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:104)
    at b4j.example.main._appstart(main.java:80)
    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.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    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.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    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)

The Region entry on Main is;
B4X:
    #Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 800
    #AdditionalJar: sqlite-jdbc-3.32.3.2
    #AdditionalJar: bcprov-jdk15on-154
#End Region

and the init code is;
B4X:
SQL1.Initialize(SQLDataBasePath, SQLDateBaseName)

The two variables are logged in the first bunch of code

Any pointers would be appreciated
 
Top