“No suitable driver found” when running from JAR [duplicate]

主宰稳场 提交于 2019-12-01 18:48:52

When you build your project in NetBeans it creates a dist folder in the home folder of your project, puts the JAR file for your code in that folder, and also puts the dependencies (JAR files for required components like UCanAccess, Jackcess, HSQLDB, and Apache Commons bits) into a subfolder named lib. You need to ensure that the lib folder gets copied to the target machine and placed in the same folder as your main JAR file. Look here for details.

liponcio

You could go for the fat-jar approach. You can see it here if you use ant.

If have a maven project you could have this plugin to create a fat-jar

The benefit of a fat-jar application is that you could have everything inside one jar and don't need to worry with the lib dir like it was mentioned in another answer.

Also be careful with hard-coded paths like:

String strurl="jdbc:ucanaccess://C:\\Users\\Paul\\Desktop\\Spelli\\RispostiDB.mdb";

that you have in your code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!