I am new to programming, of which I do not know much, I ask for help to verify why this problem occurs: if I run the program on the "eclipse" platform, everything works correctly, but when I export and execute it, this error occurs: java. lang.ClassNotFoundException: com.mysql.jdbc.Driver
This is the code:
public void createTableRegister() {
String tableName="register";
String columnType1="VARCHAR(60)";
String columnType2="INT(30)";
String column1="Apellidos";
String column2="Nombres";
String column3="DNI";
String column4="Correo";
String column5="Contraseña";
String query="CREATE TABLE IF NOT EXISTS `"+tableName+"`(`"+column1+"` "+columnType1+", `"+column2+"` "+columnType1+", `"+column3+"` "+columnType2+", `"+column4+"` "+columnType1+", `"+column5+"` "+columnType1+")";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://"+getHost()+":"+getPort()+"/"+getDatabase();
String un=getUsername();
String ps=getPassword();
con=DriverManager.getConnection(url,un,ps);
Statement stmt = con.createStatement();
stmt.executeUpdate(query);
} catch (Exception e) {
System.out.println("ERROR CreateTableRegister: "+e);
}
}