title: java.lang.ClassNotFoundException:com.mysql.jdbc.Driver
body: <p>I'm getting the exception <code>java.lang.ClassNotFoundException</code> when I am trying to run my code,  </p>
  
  <p><strong>My Code</strong>  </p>
  
  <pre><code>   try 
     {
       Class.forName("com.mysql.jdbc.Driver");
       Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/simple",
        "root","root");
       Statement stmt=con.createStatement();
       String query="SELECT * FROM CUST";
       ResultSet rs=stmt.executeQuery(query);
       while(rs.next())
       {
            System.out.print(rs.getString("CUST_NAME") +" ");
            System.out.print(rs.getString(2) +" ");
            System.out.print(rs.getString(3) +" ");
  
       }    
       rs.close();
       stmt.close();
       con.close();    
    }   
    catch (ClassNotFoundException e) 
    {
       e.printStackTrace();
    }
    catch (SQLException e) 
    {
       e.printStackTrace();
    }    
  </code></pre>
  
  <p><strong>I'm getting Error</strong>  </p>
  
  <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:169)
  at Simple.MyProg.main(MyProg.java:15)   
  </code></pre>
  
  <p>What am I doing wrong? </p>