Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

 

  • 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?

  • 1 year later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.