B4J Question How to change or find the SQLite TEMP directory?

jmon

Well-Known Member
Licensed User
Longtime User
Hello,

I have some issues with a Windows server machine. The SQLite "temp" directory was not created automatically, and these were the errors caused by KVS:
java.lang.Exception: java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
at org.sqlite.core.NativeDB._open(Native Method)
at org.sqlite.core.DB.open(DB.java:174)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:220)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:24)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at org.sqlite.JDBC.connect(JDBC.java:88)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:57)
at anywheresoftware.b4j.objects.SQL.Initialize(SQL.java:46)
at anywheresoftware.b4j.objects.SQL.InitializeSQLite(SQL.java:118)
at com.xxx.xxx.xxx.master.keyvaluestore._initialize(keyvaluestore.java:356)
at com.xxx.xxx.xxx.master.main._appstart(main.java:731)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at com.xxx.xxx.xxx.master.main.start(main.java:38)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)

I found out by redirecting the STDOUT and reading on internet that the error was caused by the TMP dir not existing (clients deleted the content of the temp folder). I guess the app didn't have the permission to create the directory or something like that.

The file that SQLite was trying to access is this one:
C:\Users\ADMINI~1\AppData\Local\Temp\1\sqlite-unknown-691ab85e-aa2e-4acb-9718-8c5e980df1df-sqlitejdbc.dll

So the missing directory was the "1".
I created the directory manually and it worked.

How can I check if this folder exists? So I could create it if missing.

Thanks
Jmon


NOTE: this is not the same directory as returned by:
B4X:
GetEnvironmentVariable("java.io.tmpdir", "n/a")
 

jmon

Well-Known Member
Licensed User
Longtime User
Thanks, in my case I use the JavaPackager to pack in an Exe file. I guess I should add:
B4X:
-BjvmProperties=java.io.tmpdir="temp"
to the packager options right?

B4X:
   args.AddAll(Array ("-deploy", "-v", "-srcdir", TextAddDir.Text, "-argument", txtJar.Text, "-native", packageExtension, _
        "-BsystemWide=true", "-BjvmOptions=-Xmx512m", "-title", txtTitle.Text, "-name", txtName.Text, "-outdir", workingFolder, _
        "-outfile", "1.exe", "-BappVersion=" & txtVersion.Text, "-appclass", appClass, _
        "-Bidentifier=" & appClass, "-BmenuHint=true", "-Bwin.menuGroup=Jmon", "-Bvendor=Jmon", _
        "-BlicenseFile=LICENSE.rtf", "-srcfiles", "Master.jar;LICENSE.rtf;updater.sh;Slave.jar;version.txt"))

Thanks a lot
 
Upvote 0
Top