Posted June 4, 20223 yr Minecraft version: 1.18.2 Forge version: 40.1.29 I want to connect to database with my minecraft mod, in the Internet I found solution to add lib MySQL connector/J and Class.forName("com.mysql.cj.jdbc.Driver"); line, but i get java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver. How can i import MySQL connector/J into my mod?
June 4, 20223 yr Author I dont know how to do it in forgeGradle, i dont find any docs or examples. Can you tell me how to do it pls?
June 13, 20232 yr Working example plugins { //...... } version = '1.0' group = 'com.bodryak.gmod' archivesBaseName = 'gmodmod' jarJar.enable() tasks.jarJar.configure { } minecraft {.....} dependencies { minecraft 'net.minecraftforge:forge:1.19.2-43.2.3' implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.33' jarJar(group: 'mysql', name: 'mysql-connector-java', version: '[8.0.26,8.0.33)'){ jarJar.pin(it, "8.0.33") } } inser : jarJar.enable() tasks.jarJar.configure { } before minecraf{ } and implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.33' jarJar(group: 'mysql', name: 'mysql-connector-java', version: '[8.0.26,8.0.33)'){ jarJar.pin(it, "8.0.33") } in dependencies and after compilation the connector will be embroidered into the jar in order for the connector to work in the test environment during runtime, you need edit file runClient_minecraftClasspath insert full path to mysql connector in the first line after that mysql connector will run with the client if that doesn't work, you'll need to deep tune the programming environment, but the point remains the same: you'll need to configure the launch options for the client along with the MSCL library
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.