Skip to content

JDA Discord Bot Hosting

Java bots run from a single jar. Build your JDA or Javacord bot into a jar that bundles its dependencies, upload it, and the server runs it on Java 17 or Java 21.

The panel starts the jar named in Bot Jar File, so you can keep several builds on the server and switch between them by changing one setting.

Java versions
17 and 21
Runs
Your jar (Bot Jar File, default bot.jar)
Deploy
Upload a jar, or a Git repo that contains one
Memory
Uses up to 95% of your plan RAM

A bot that runs here as it is

A minimal JDA 5 bot. Build a fat jar (for example with the Gradle Shadow plugin) so JDA ships inside it.

Bot.java
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.build.Commands;

public class Bot extends ListenerAdapter {
    public static void main(String[] args) {
        var jda = JDABuilder.createDefault(System.getenv("DISCORD_TOKEN"))
                .addEventListeners(new Bot())
                .build();
        jda.updateCommands().addCommands(Commands.slash("ping", "Check the bot is alive")).queue();
    }

    @Override
    public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
        if (event.getName().equals("ping")) {
            event.reply("Pong").queue();
        }
    }
}

How to host a JDA bot on Zeros Host

  1. 1

    Create the bot in the Discord Developer Portal

    Go to discord.com/developers/applications, create an application, open the Bot tab and press Reset Token to copy your token. Under OAuth2, pick the bot and applications.commands scopes, choose the permissions your bot needs, and open the generated link to add the bot to your server.

  2. 2

    Build a jar with its dependencies inside

    Run your build tool so it produces one jar containing JDA and everything else, such as gradle shadowJar or the Maven Shade plugin. A plain jar without dependencies fails with NoClassDefFoundError.

    ./gradlew shadowJar
  3. 3

    Create a Java bot server

    Start a free trial or pick a Discord Bot plan and choose Java. Pick Java 17 or 21 on the Startup page to match what you built against.

  4. 4

    Add your bot token

    Open the Startup page for your server and paste your token into Discord Token. The panel passes it to your bot as the DISCORD_TOKEN environment variable, so it never has to sit inside your code or your Git repository.

  5. 5

    Upload the jar and point Bot Jar File at it

    Upload the jar in the File Manager and set Bot Jar File on the Startup page to its name. If you deploy from Git instead, commit the built jar to the repo; the install tells you the jar name it found.

  6. 6

    Start it

    Press Start and watch the console for your bot logging in. To update, upload the new jar and restart.

Common JDA errors and fixes

Error: Unable to access jarfile bot.jar

Bot Jar File does not match the jar you uploaded. Set it to the exact file name, including .jar.

NoClassDefFoundError: net/dv8tion/jda/...

Your jar does not include JDA. Build a fat jar with Shadow or Shade and upload that one.

UnsupportedClassVersionError

The jar was built for a newer Java than the server runs. Switch the server to Java 21 on the Startup page, or build with a Java 17 target.

Used disallowed intents

Your code asks for a privileged intent (Message Content, Server Members or Presence) that is switched off for your bot. Turn it on under Bot, Privileged Gateway Intents in the Developer Portal, or remove it from your code.

An invalid token was provided

The token in Discord Token is wrong or was reset. Reset it in the Developer Portal, paste the new one on the Startup page and restart. Discord also resets tokens it finds in public GitHub repositories, so keep yours out of your code.

Which plan fits

The Java runtime itself needs memory before your bot does anything. Small JDA bots start on 512 MB, but 1 GB gives the JVM room to breathe, so Pro is the plan we suggest for most Java bots.

Starter

£1/mo

256 MB RAM · 5 GB

Standard

£3/mo

512 MB RAM · 10 GB

Pro

£5/mo

1 GB RAM · 15 GB

Suggested for this bot

Enterprise

£6/mo

2 GB RAM · 25 GB

Try it free for 48 hours

Start a 48-hour Discord bot trial with no card needed. Pick your runtime and your server is ready in seconds. Plans start at £1 a month after that.

Frequently asked questions

Can the server build my Java bot from source?

Not at the moment. Build the jar on your own machine or in CI and upload it, or commit the built jar to your repository.

Does Javacord work too?

Yes. Any library works as long as your jar contains it and reads the token from the DISCORD_TOKEN environment variable.

More Discord bot hosting guides