0

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?

Anthony
  • 1
  • 1
  • I took a look at the GitHub page to see if it would say compatible with Java9+. I did not see that anywhere. My guess is that the jar you have is not compatible with Java9+. See if https://stackoverflow.com/questions/46882108/how-to-find-automatic-modules-with-javapackager helps. – SedJ601 Mar 17 '20 at 05:23

1 Answers1

-2

I have SQLite running without problems. For building I follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which I created together with Dirk Lemmermann. There isn't anything special to do for SQLite. If you want to use it via the Maven shade plugin or the GraalVM things get a little bit more complicated but it also works.

mipa
  • 10,369
  • 2
  • 16
  • 35