I'm working on a Maven JavaFX project with sqlite and my goal is to create an installer using jpackage. One of the first steps is to create a runtime image. So I was planning on creating the image, make sure that it runs and then create an installer using jpackage.
These are my dependencies in Maven:
org.openjfx javafx-controls 14 org.openjfx javafx-fxml 14 org.xerial sqlite-jdbc 3.30.1 jar
This is how I connect to the db:
connection=(Connection) DriverManager.getConnection("jdbc:sqlite:"+getClass().getResource("database.db"));
I create the runtime image with maven:
mvn clean javafx:jlink
And when I run the image I get the following error:
java.sql.SQLException: No suitable driver found for jdbc:sqlite:
I tried adding Class.forName("org.sqlite.JDBC");
but now I'm getting:
java.lang.ClassNotFoundException: org.sqlite.jdbc
I already tried following these instructions but I keep getting the same errors.
Everything works fine when I run the project using InteliJ. I've been trying to get this to work for a while now and I keep failing. Does anyone know what I'm doing wrong or what I need to add or change?