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)

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

It is not a web project, it is to be run on an Intel Edison board. So Eclipse loads it into the board.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.