I am new in java development. Creating demo project using java + javafx + maven in eclipse it is working fine and able to connect embedded database sqlite and run query easily. But when I created build through jpackager following commands

project location > mvn clean

mvn package

sh/link.sh -e

sh/create-appimage.sh -e

Successfully created mac build when I run this javafx screen comes out but it's not table to connect org.sqlite.JDBC. It gives Exception java.lang.ClassNotFoundException: org.sqlite.JDBC. I have checked maven pom.xml file that already added sqlite jar file. Please help me. Is any thing I am missing or in deployment this JDBC driver will not work ? Is there any other method to connect ?

JDBC configuration in my code is

static final String JDBC_DRIVER = "org.sqlite.JDBC";
static final String DB_URL = "jdbc:sqlite:src/main/resources/example.db";

public static Connection getConnection()  {
    Connection conn = null;

        // STEP 2: Register jdbc drive

        Class.forName(JDBC_DRIVER);

        // STEP 3 : Open a connetion

        System.out.println("connecting to database....");

        conn = DriverManager.getConnection(DB_URL);
        return conn;
    }
0

There are 0 best solutions below