title: class not found exception for com.mysql.jdbc.Driver not a classpath problem
body: <p>I've been working on this for weeks, and now I'm just running in circles. I'm getting the runtime error: " class not found exception in [class] while getting connection com.mysql.jdbc.Driver ".</p>
  
  <p>The connection function is as follows:</p>
  
  <pre><code>/**
   * @return a MySQL connection to the server as specified above 
   */
  private static Connection getConnection() {
    Connection con = null;
    try {
      Class.forName("com.mysql.jdbc.Driver");
      con = DriverManager.getConnection(url, username, password);
    } catch (ClassNotFoundException e) {
      System.err.println("class not found exception in [class] while getting connection " + e.getMessage());
    } catch (SQLException e) {
      System.err.println("sql exception in [class] while getting connection " + e.getMessage());
    }
    return con;
  } //end getConnection
  </code></pre>
  
  <p>I have set the <code>$CLASSPATH</code> a hundred times a hundred ways, and still no luck. This is what it looks like now:</p>
  
  <pre><code># echo $CLASSPATH
  :/usr/share/java/mysql-connector-java-5.1.13-bin.jar:/usr/share/java/mysql-connector-java-3.0.17-ga-bin.jar:
  </code></pre>
  
  <p>Both of those files exist and have the Driver.class file in them in the right place. </p>
  
  <p>I even tried importing the class into my code before exporting the jar, but that caused a world of other problems.</p>
  
  <p>I'm using Eclipse 3.5.2 and the server is running Fedora 13 x86_64</p>
  
  <p>Please help.</p>
  
  <p>edit: I'm running the code remotely on my server with the command:</p>
  
  <pre><code># java -jar program.jar
  </code></pre>