Java
Install and manage a Java JDK locally (Windows, macOS, Linux) using installers, package managers, or SDKMAN!; build a runnable JAR with Maven or Gradle.
๐งพ Overview
Java runs on the JVM and is used for Discord bots (JDA, Discord4J), APIs (Spring Boot, Javalin), and background services. A local JDK lets you:
Compile and run your project before uploading it to Discloud
Manage dependencies with Maven or Gradle
Build the runnable
.jarthat you upload to Discloud
๐ฅ Installation
Install a JDK (not just a JRE): the JDK includes the javac compiler. The examples below use Eclipse Temurin, a free OpenJDK build. Pick an LTS version (e.g. 21).
Open https://adoptium.net/ and download the LTS .msi installer
Run the installer and enable Set JAVA_HOME variable and Add to PATH
Reopen the terminal and verify
๐งฐ Build Tools (Maven or Gradle)
Most Java projects use a build tool to download dependencies and produce the .jar. Use the one your project already has (pom.xml = Maven, build.gradle = Gradle).
If the project has a Gradle wrapper (gradlew), you don't need to install Gradle: use ./gradlew (or gradlew.bat on Windows).
๐งช Minimal Workflow
Build the project into a JAR
Test the JAR locally before uploading
Upload the .jar to Discloud, with MAIN in your discloud.config pointing to it.
๐ Updating
Update JDK (SDKMAN!)
sdk upgrade java
Update JDK (Homebrew)
brew upgrade --cask temurin@21
Update JDK (winget)
winget upgrade EclipseAdoptium.Temurin.21.JDK
Check dependency updates (Maven)
mvn versions:display-dependency-updates