title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver if the project built into jar
body: <p>I made my project use NetBeans, when I run it through NetBeans, it can run properly without any errors at all.
  But, when I build it into a jar file and try to login to  my application, I get an error:</p>
  
  <blockquote>
    <p>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/yaJLP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yaJLP.png" alt="error1"></a></p>
  
  <p>And in cmd :</p>
  
  <p><a href="https://i.stack.imgur.com/aUL82.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aUL82.png" alt="error"></a></p>
  
  <p>I have been do <a href="https://stackoverflow.com/a/17762254/4369288">this</a> tutorial and it not work.
  And I have been read and follow tutorial that was similar with this my problem in this website and others website, but nothing work for me.</p>
  
  <p>this is my library :
  <a href="https://i.stack.imgur.com/SmfcP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SmfcP.png" alt="my library"></a></p>
  
  <p>And this is my code </p>
  
  <pre><code> package config;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  import java.sql.Statement;
  import javax.swing.JOptionPane;
  /**
   *
   * @author nasution
   */
  public class Koneksi {
      private static Connection koneksi;
      public static Statement stm;
  
      public static Connection getKoneksi() throws ClassNotFoundException{
          try{
              Class.forName("com.mysql.jdbc.Driver");
                  koneksi = DriverManager.getConnection("jdbc:mysql://localhost/db_surat","root","");
          }catch(SQLException e){
              JOptionPane.showMessageDialog(null, "koneksi gagal"+ e.getMessage());
          }
          return koneksi;
      }
  
  }
  </code></pre>
  
  <p>this is my project that has been converted to jar :
  <a href="https://i.stack.imgur.com/RNzgI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RNzgI.png" alt="project jar"></a></p>
  
  <p>and this is my library in folder "dist/lib" that was generated when I built the project
  <a href="https://i.stack.imgur.com/JkpHP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JkpHP.png" alt="my library"></a></p>