0

Im getting started with Eclipse IoT and when trying to create the SQL connector I get the errors bellow. I have added the classpath in windows and the corresponding .jar library is added to the project as advised in https://stackoverflow.com/questions/8745872/classnotfoundexception-com-mysql-jdbc-drive. I cannot get why Im still getting this error. Any ideas?

The code that generates the error:

public static void getConnection(){
    try{
        Class.forName("com.mysql.jdbc.Driver");
        }
        catch (ClassNotFoundException e){
            System.out.print(" Class.forName cannot be found");
            e.printStackTrace();
        }

And I get this:

 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)
Community
  • 1
  • 1
JuanV
  • 13
  • 4

1 Answers1

0

if its a web-project: check whether the jar (or the folder which contains the jar) is really in the the Deployment Assembly of your project (which is set in the project properties). If not, add it.

Raphael Roth
  • 26,751
  • 15
  • 88
  • 145
  • It is not a web project, it is to be run on an Intel Edison board. So Eclipse loads it into the board. – JuanV Mar 08 '16 at 12:30