Perhaps this will help you get the right path to your database.
How to specify database files
Here is an example of selecting the file C: \ work \ mydatabase.db (on Windows)
Connection connection = DriverManager.getConnection("jdbc:sqlite:C:/work/mydatabase.db");
UNIX file (Linux, Mac OS X, etc.) / home / leo / work / mydatabase.db
Connection connection = DriverManager.getConnection("jdbc:sqlite:/home/leo/work/mydatabase.db");
How to use memory databases
SQLite supports database management on a database that does not create any database files. To use the memory database in your Java code, connect to the database as follows:
Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:");
It may also help.
String path=this.getClass().getResource("apartments.db").getPath();
connection = DriverManager.getConnection("jdbc:sqlite:"+path);
, apartment.db