Exception in thread "main" java.lang.NoClassDefFoundError: MySQLJDBCDriverTest

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jith87
    New Member
    • Jul 2007
    • 58

    Exception in thread "main" java.lang.NoClassDefFoundError: MySQLJDBCDriverTest

    What is ths error.????? I m nw loading the JDBC driver for connection with MySql.

    Exception in thread "main" java.lang.NoCla ssDefFoundError : MySQLJDBCDriver Test
  • madhoriya22
    Contributor
    • Jul 2007
    • 251

    #2
    Originally posted by jith87
    What is ths error.????? I m nw loading the JDBC driver for connection with MySql.

    Exception in thread "main" java.lang.NoCla ssDefFoundError : MySQLJDBCDriver Test
    Hi,
    I think you have not provided the path of you MysqlConnector. jar to the class path. Try this.

    Comment

    • jith87
      New Member
      • Jul 2007
      • 58

      #3
      Originally posted by madhoriya22
      Hi,
      I think you have not provided the path of you MysqlConnector. jar to the class path. Try this.

      No i ve provided the path to the connector.

      Comment

      • madhoriya22
        Contributor
        • Jul 2007
        • 251

        #4
        Originally posted by jith87
        No i ve provided the path to the connector.
        Hi,
        Can u send the code(relevant) line exactly where you are getting the exception

        Comment

        • jith87
          New Member
          • Jul 2007
          • 58

          #5
          Originally posted by madhoriya22
          Hi,
          Can u send the code(relevant) line exactly where you are getting the exception
          hi ths s the code......

          import java.lang.*;
          import java.sql.*;

          public class sample2
          {
          public static void main(String[] args)
          {
          try
          {
          Class.forName(" com.mysql.jdbc. Driver").newIns tance();
          System.out.prin tln("Good to go");
          }

          catch (Exception E)
          {
          System.out.prin tln("JDBC Driver error");
          }
          }
          }

          Comment

          • madhoriya22
            Contributor
            • Jul 2007
            • 251

            #6
            Originally posted by jith87
            hi ths s the code......

            import java.lang.*;
            import java.sql.*;

            public class sample2
            {
            public static void main(String[] args)
            {
            try
            {
            Class.forName(" com.mysql.jdbc. Driver").newIns tance();
            System.out.prin tln("Good to go");
            }

            catch (Exception E)
            {
            System.out.prin tln("JDBC Driver error");
            }
            }
            }
            Hi,
            When I run your code in my system ..... It worked properly. So again I vil suggest you to check all your classpaths. Are you running your application from command prompt or in some IDE ?

            Comment

            • jith87
              New Member
              • Jul 2007
              • 58

              #7
              Originally posted by madhoriya22
              Hi,
              When I run your code in my system ..... It worked properly. So again I vil suggest you to check all you classpaths. Are you running your application from command prompt ?

              Yes i m running ths in application prompt.....

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by jith87
                hi ths s the code......

                import java.lang.*;
                import java.sql.*;

                public class sample2
                {
                public static void main(String[] args)
                {
                try
                {
                Class.forName(" com.mysql.jdbc. Driver").newIns tance();
                System.out.prin tln("Good to go");
                }

                catch (Exception E)
                {
                System.out.prin tln("JDBC Driver error");
                }
                }
                }
                1.) Use code tags
                2.) How did you specify the path to the connector jar?

                Comment

                • jith87
                  New Member
                  • Jul 2007
                  • 58

                  #9
                  Originally posted by r035198x
                  1.) Use code tags
                  2.) How did you specify the path to the connector jar?
                  What is meant by code tags?

                  D:\mysql-5.0.45-win32\mysql-connector-java-3.1.14\mysql-connector-java-3.1.14-bin.jar;%CLASSP ATH%

                  ths s the classpath variable address i ve mentioned. mysql-5.0.45-win32 is the name of the folder whr mysql is installed.. then mysql-connector-java-3.1.14 is the folder (downloaded frm mysql.com) whr the connector is situated. mysql-connector-java-3.1.14-bin.jar is the .jar file..... dat %CLASSPATH% was specified in book i jus followed actually i m a beginner in java n jdbc so i dunno wht it exactly means.....If u can pls suggest me a buk for jdbc connectivity wid mysql.

                  ths program is being run in command prompt.

                  Comment

                  • madhoriya22
                    Contributor
                    • Jul 2007
                    • 251

                    #10
                    Originally posted by jith87
                    What is meant by code tags?

                    D:\mysql-5.0.45-win32\mysql-connector-java-3.1.14\mysql-connector-java-3.1.14-bin.jar;%CLASSP ATH%

                    ths s the classpath variable address i ve mentioned. mysql-5.0.45-win32 is the name of the folder whr mysql is installed.. then mysql-connector-java-3.1.14 is the folder (downloaded frm mysql.com) whr the connector is situated. mysql-connector-java-3.1.14-bin.jar is the .jar file..... dat %CLASSPATH% was specified in book i jus followed actually i m a beginner in java n jdbc so i dunno wht it exactly means.....If u can pls suggest me a buk for jdbc connectivity wid mysql.

                    ths program is being run in command prompt.
                    Hi,
                    I will suggest you to read some tutorials on classpath. I have found these, suitable for you ...


                    I hope this will help you :)

                    Comment

                    Working...