2

Good evening,

I try to open a connection on SQLite via JAVA (i have putted the SQLlite jar into my project folder):

import java.sql.Connection;
import java.sql.DriverManager;

public class SQLiteJDBC
{
  public static void main( String args[] )
  {
    Connection c = null;
    try {
      Class.forName("org.sqlite.JDBC");
      c = DriverManager.getConnection("jdbc:sqlite:test.db");
    } catch ( Exception e ) {
      System.err.println( e.getClass().getName() + ": " + e.getMessage() );
      System.exit(0);
    }
    System.out.println("Opened database successfully");
  }
}

$javac SQLiteJDBC.java
$java -classpath ".:sqlite-jdbc-3.8.11.2.jar" SQLiteJDBC
Open database successfully

But Java send me this error back:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at SQLiteJDBC.main(SQLiteJDBC.java:6)

I would be grateful if you could tell me where it can come from. Thanks!

Freelancef
  • 21
  • 2

1 Answers1

0

The code is absolutely work, and the Error may cause by few possible ways.

Check the topic:

Java: Unresolved compilation problem

If you installed not only one java jdk and jre, notice that the mismatch of compliance level and jre version might cause it too.

Community
  • 1
  • 1
TomN
  • 574
  • 3
  • 18