0
Im我開始使用Eclipse IoT並嘗試創建SQL連接器時出現以下錯誤。我在窗口中添加了類路徑,並將相應的.jar庫添加到項目中,如https://stackoverflow.com/questions/8745872/classnotfoundexception-com-mysql-jdbc-drive中的建議。我無法得到爲什麼我仍然得到這個錯誤。有任何想法嗎?爲什麼我總是在Eclipse IoT上收到ClassNotFoundException:com.mysql.jdbc.Driver錯誤
生成錯誤代碼:
public static void getConnection(){
try{
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e){
System.out.print(" Class.forName cannot be found");
e.printStackTrace();
}
而且我得到這個:
Class.forName cannot be foundjava.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at controller.establishConnection.getConnection(establishConnection.java:17)
這不是一個web項目,它將在英特爾Edison主板上運行。所以Eclipse將它加載到電路板上。 – JuanV