title: i got error in java jdbc mysql in terminal(mac) so how to fix this error?
body: <p>I am recently run java program in terminal in mac. I write one jdbc with mysql program, i think whole program is write but it throws error that i mentioned in output. so please help me to solve this error and also tell me at which place should i place the mysql connector.</p>
  
  <p>program code is as follow,</p>
  
  <pre><code>import java.util.*;
  import java.sql.*;
  class DBConnectio
  {
  int id;
  String name,pass;
  Connection con;
  Statement st;
  ResultSet rs;
  Scanner sc=new Scanner(System.in);
  void getData()
  {
      System.out.println("Enter id:");
      id=sc.nextInt();
      System.out.println("Enter username:");
      name=sc.next();
      System.out.println("Enter Password:");
      pass=sc.next();
  
  }
  DBConnectio()throws Exception
  {
  
      Class.forName("com.mysql.jdbc.Driver");
      con = 
      DriverManager.getConnection("jdbc:mysql://localhost:3306/javadata",
      "root","root");
      st = con.createStatement(); 
  
  }
  void menu()throws Exception
  {
      System.out.println("1.Insert");
      System.out.println("2.Update");
      System.out.println("3.Delete");
      System.out.println("Enter choice:");
      int n=sc.nextInt();
      switch(n)
      {
          case 1: insert(); break;
          case 2: update(); break;
          case 3: delete(); break;
          default: System.out.println("Wrong choice");
      }
   }
      void insert()throws Exception
      {
          getData();
          String q="insert into student values 
          ("+id+",'"+name+"','"+pass+"')";
          int n=st.executeUpdate(q);
          System.out.println(n+ "rows inserted...");
      }
      void update()throws Exception
      {
          getData();
          String q="update student set uname='"+name+"',pass='"+pass+"' 
          where id="+id+" ";
          int n=st.executeUpdate(q);
          if(n==0)
          {
              System.out.println("no record found..");
          }
          else
           {
              System.out.println(n+ "rows updated...");   
          }
      }
      void delete()throws Exception
      {
          System.out.println("Enter id:");
          id=sc.nextInt();
          String q="delete from student where id="+id;
          int n=st.executeUpdate(q);
          if(n==0)
          {
              System.out.println("no record found..");
          }
          else
           {
              System.out.println(n+ "rows deleted...");   
          }
      }
  
     }
  
  class demo
  {
  public static void main(String[] args)throws Exception
   {
      DBConnectio z=new DBConnectio();
      z.menu();
  
  }
  }
  </code></pre>
  
  <p>i got output like this,</p>
  
  <pre><code>vishals-MacBook-Pro:desktop vishalbarad$ javac demo.java
  vishals-MacBook-Pro:desktop vishalbarad$ java demo
  Exception in thread "main" java.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:335)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:264)
  at DBConnectio.&lt;init&gt;(demo.java:24)
  at demo.main(demo.java:87)
  </code></pre>