title: how to compile mysql JDBC driver with a java file in cmd
body: <p>I want to compile .java file with MYsql JDBC Connector </p>
  
  <p>This is where the .jar file is </p>
  
  <p>D:\mysql-connector-java-5.1.31-bin.jar</p>
  
  <p>This is what I used to compile...</p>
  
  <p>javac -cp "D:\mysql-connector-java-5.1.31-bin.jar" LocationServer.java</p>
  
  <p>Code for LocationServer.java</p>
  
  <pre><code>import java.rmi.Naming;
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.text.DecimalFormat;
  import java.text.NumberFormat;
  import java.util.ArrayList;
  
  public class LocationServer  {
  
  private static final long serialVersionUID = 1L;
  private Connection conn;
  private final String driver = "com.mysql.jdbc.Driver";
  private boolean connection;
  
  protected LocationServer() {
      try {
          Class.forName(driver);
      } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      System.out.println("Driver Found");
      location = null;
      x = null;
      y = null;
      conn = null;
      connection = false;
  }
  
  public static void main(String[]args){
      LocationServer ls = new LocationServer();
  }
  </code></pre>
  
  <p>When I run the the code from CMD ClassNotFoundException throws error.</p>
  
  <p>How can I properly connect a .jar file with LocationServer.java so that MySql Driver class is found?</p>