值java.sql.SQLException:路径

时间:2017-08-24 21:14:52

标签: java database sqlite launch4j

当我将我的java项目更改为.exe文件然后我在另一台PC The Error中尝试时,我收到此错误 这是连接到SQLite数据库的代码

public static Connection dbConnector() {
    try {
        Class.forName("org.sqlite.JDBC");
        Connection conn=DriverManager.getConnection("jdbc:sqlite:C:\\Users\\3542\\Desktop\\DocProject\\DoctorProject.db");
        //JOptionPane.showConfirmDialog(null, "connection succesfull");
        return conn;

    }catch(Exception e)
    {
        JOptionPane.showConfirmDialog(null, e);
        return null;
    }
}

我希望找到一种方法,当我将我的应用程序转移到另一台PC时,我的数据库将正常工作 我正在使用Eclipse SQLite和Lanuch4j进行.exe

先谢谢

1 个答案:

答案 0 :(得分:1)

路径不存在。如果你想在其他电脑上运行它我会建议你使用相对路径而不是绝对路径。

相关问题