Add JDA to your build.gradle or build.gradle.kts file:
repositories { mavenCentral()}dependencies { implementation("net.dv8tion:JDA:$version") { // replace $version with the latest version // Optionally disable audio natives to reduce jar size by excluding `opus-java` and `tink` // Gradle DSL: // exclude module: 'opus-java' // required for encoding audio into opus // exclude module: 'tink' // required for encrypting and decrypting audio }}
Replace $version with the latest version number from Maven Central.
Add JDA to your pom.xml file:
pom.xml
<dependency> <groupId>net.dv8tion</groupId> <artifactId>JDA</artifactId> <version>$version</version> <!-- replace $version with the latest version --> <!-- Optionally disable audio natives to reduce jar size by excluding `opus-java` and `tink` --> <exclusions> <!-- required for encoding audio into opus, not needed if audio is already provided in opus encoding <exclusion> <groupId>club.minnced</groupId> <artifactId>opus-java</artifactId> </exclusion> --> <!-- required for encrypting and decrypting audio <exclusion> <groupId>com.google.crypto.tink</groupId> <artifactId>tink</artifactId> </exclusion> --> </exclusions></dependency>
Replace $version with the latest version number from Maven Central.
After adding JDA to your project, verify the installation by creating a simple test file:
Test.java
import net.dv8tion.jda.api.JDABuilder;public class Test { public static void main(String[] args) { System.out.println("JDA imported successfully!"); }}
If your IDE can resolve the import and the code compiles without errors, JDA has been successfully added to your project.