Hello,
i'm currently working on a mysql database which im trying implement in with my minecraft project.
My problem is, that if i export my project (with the minecraft classes of course) it throws an ClassNotFoundException for "com.mysql.cj.jdbc.Driver"
Strangely, its working in debug mode but not when i export it.
I have also already added the correct mysql-connector.jar to the libraries, as well as searching for reasons online..
I hope that someone will the cause for this and help me out with it.
Console output:
01:47:16 game info java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
01:47:16 game info at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
01:47:16 game info at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
01:47:16 game info at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
01:47:16 game info at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
01:47:16 game info at java.lang.Class.forName0(Native Method)
01:47:16 game info at java.lang.Class.forName(Class.java:264)
01:47:16 game info at me.freakzboy.testclient.TestClient.startClient(CountDown.java:41)
01:47:16 game info at net.minecraft.client.Minecraft.startGame(Minecraft.java:575)
01:47:16 game info at net.minecraft.client.Minecraft.run(Minecraft.java:410)
01:47:16 game info at net.minecraft.client.main.Main.main(Main.java:114)
01:47:16 game info jdbc driver unavailable!
public void startClient() {
instance = this;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
//this accesses Driver in jdbc.
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.err.println("jdbc driver unavailable!");
return;
}
MySQL.connect();
}
public static void connect() {
if(isConnected() == false) {
try {
con = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
System.out.println("[MySQL] Successfully connected!");
} catch (SQLException e) {
System.out.println("[MySQL] Error.");
e.printStackTrace();
}
}
}
Thanks,
Freakz