2016-03-08 84 views
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) 

回答

0

如果一个Web项目:检查是否罐子(或包含的jar文件夹)确实在项目的Deployment Assembly中(在项目属性中设置)。如果没有,请添加它。

+0

这不是一个web项目,它将在英特尔Edison主板上运行。所以Eclipse将它加载到电路板上。 – JuanV

相关问题