← All guides
Guide

Host a Java bot (JDA or Discord4J)

Upload a runnable .jar, we run it on Java 21.

  1. Build a runnable jar that includes its libraries: mvn package with the Maven Shade plugin, or gradle shadowJar with the Shadow plugin. The jar needs a Main-Class in its manifest.
  2. Upload the .jar (up to 40 MB) in the Files tab, plus any config files it reads. It becomes the start file.
  3. Add DISCORD_TOKEN in Secrets and read it with System.getenv("DISCORD_TOKEN").
  4. Press Deploy. We run java -jar on Java 21 with the heap sized to your plan (75% of its memory), and stop cleanly instead of hanging if memory runs out.
Java bots need more memory than Python or Node.js ones: Pro (512 MB) is the smallest plan we suggest for JDA.

Still stuck? Log in and ask support, or check the service status. New here? See bot hosting plans from $0.70 a month.

More Discord bot guides

Host a Discord bot 24/7 (Python, Node.js or Java)From a bot on your computer to a bot that never goes offline.Host a discord.js (Node.js) botNode.js 22 with your package.json, online 24/7.Keep your Discord bot token safeNever put the token in your code; use an encrypted secret.Upload a multi-file bot (cogs, folders)Projects with cogs, config files and folders work as they are.My Discord bot is offline or keeps crashingRead the reason, fix it, deploy again.Host a music or voice botFFmpeg and Opus are added for you.

Discord bot hosting plans · How we compare