Deploy a Java bot (JDA, Javacord and others)
Java bots run as a single .jar file. The key is building a jar that already contains all its dependencies.
1. Build a "fat" jar
A normal jar build leaves dependencies out, and the bot fails on the server with NoClassDefFoundError. Build a jar with dependencies included instead.
Gradle (with the Shadow plugin):
plugins {
java
id("com.gradleup.shadow") version "8.3.5"
}
tasks.jar {
manifest { attributes["Main-Class"] = "com.example.bot.Main" }
}
Then run ./gradlew shadowJar - your jar is in build/libs/ and ends in -all.jar.
Maven: use the maven-shade-plugin or maven-assembly-plugin with jar-with-dependencies, and set your Main-Class in the manifest.
2. Pick your Java version
On the panel's Startup tab, choose a Docker Image with the Java version you compiled for (JDA 5 needs Java 11+; Java 21 is a safe choice).
3. Upload and start
- Upload the jar to the main folder using the file manager or SFTP.
- On Startup, set the jar file variable to your jar's exact name, e.g.
mybot-all.jar. - Click Start and watch the console.
Configuration and tokens
Java doesn't read .env files by itself. Either use a library like dotenv-java, or read a config.properties file you upload next to the jar. Never hard-code your token - see Environment variables for bots.
Memory
The JVM uses the memory your plan allows. If you see java.lang.OutOfMemoryError, your bot needs a bigger plan or has a memory leak (often an unbounded cache).
Common errors
| Console message | Fix |
|---|---|
no main manifest attribute | Set Main-Class in your build's jar manifest. |
NoClassDefFoundError | You uploaded a thin jar - build the shaded/fat jar. |
UnsupportedClassVersionError | The server's Java is older than your build target - pick a newer Docker image. |
Still stuck? Open a ticket on Discord - run /ticket in any channel, pick a department, and include your Server ID or Invoice ID so we can jump straight in.