I just created a SQLite database called database.db in IntelliJ. When I'm trying to connect my code to database, I get the following error
java.lang.ClassNotFoundException: org.sqlite.JDBC
I added JDBC manually to dependencies and the connection in database window is good. This is my code:
public static void connect() {
Connection c = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:database.db");
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
}
System.out.println("Opened database successfully");
}