How to Install Java with DCEVM and HotswapAgent on Debian 12
Install OpenJDK on Debian 12 and add JetBrains Runtime with DCEVM and HotswapAgent to reload changed classes in a running JVM. The old openjdk-8-jre-dcevm package is gone.
This guide sets up a Java runtime with DCEVM (Dynamic Code Evolution VM) and HotswapAgent on Debian 12, so that you can change classes in a running application, including adding methods and fields, without restarting the JVM. It also installs the regular OpenJDK from Debian for everything that does not need hot reloading. The steps are the same on Debian 13.
Older tutorials on this topic installed openjdk-8-jre-dcevm from jessie-backports on Debian 8. Debian 8 is end-of-life, and that package no longer exists: the Debian package search shows a DCEVM package only for OpenJDK 11 in Debian 11 (bullseye) and nothing for Debian 12. DCEVM itself moved too. Today it is part of JetBrains Runtime, and that is what this guide uses.
Where DCEVM lives today
| Java version | How to get DCEVM (per the HotswapAgent project) |
|---|---|
| 17, 21, 25 | JetBrains Runtime (JBR), a JetBrains build of OpenJDK. Enhanced class redefinition is built in and switched on with -XX:+AllowEnhancedClassRedefinition. |
| 11 | TravaOpenJDK 11 DCEVM builds, with HotswapAgent integrated. |
| 8 | The old jdk8-dcevm builds, started with -XXaltjvm=dcevm. Legacy only. |
The old java -dcevm switch from the Debian package is gone. For new work use JBR 21 or 25. DCEVM is a development tool: do not run production workloads with class redefinition and a debug port enabled.
Requirements
- Debian 12 (or 13) on x86-64 or ARM64.
- A user with
sudorights. - Your application as a runnable JAR, for example
app.jar.
Step 1: Install the standard OpenJDK (optional)
For normal use, install the default JDK from Debian. On Debian 12 this is OpenJDK 17.
sudo apt update
sudo apt install -y default-jdk curl
java -version
This JDK does not include DCEVM. It stays the system default; the JetBrains Runtime below is installed next to it in /opt and is only used when you call it explicitly.
Step 2: Download JetBrains Runtime
Open the JetBrains Runtime releases page on GitHub and copy the link of the Linux jbrsdk archive for your architecture (linux-x64 or linux-aarch64). jbrsdk is the full JDK; the plain jbr archives are the runtime that is bundled with the IDEs. The example uses the JBR 21 build that was current at the time of writing; the build number changes often, so use the link you copied.
cd /tmp
curl -LO https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-21.0.11-linux-x64-b1163.125.tar.gz
curl -LO https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-21.0.11-linux-x64-b1163.125.tar.gz.checksum
Each archive has a SHA-512 checksum file next to it. Compare the two values before you unpack:
sha512sum jbrsdk-21.0.11-linux-x64-b1163.125.tar.gz
cat jbrsdk-21.0.11-linux-x64-b1163.125.tar.gz.checksum
Unpack it into /opt/jbr:
sudo mkdir -p /opt/jbr
sudo tar -xzf jbrsdk-21.0.11-linux-x64-b1163.125.tar.gz -C /opt/jbr --strip-components=1
Step 3: Add HotswapAgent
DCEVM makes the JVM accept structural class changes. HotswapAgent adds the framework side: it refreshes Spring, Hibernate and other framework state after a class changes. JBR does not ship the agent, so download the release JAR and place it in lib/hotswap inside the runtime. The file must be named exactly hotswap-agent.jar, without a version number.
sudo mkdir -p /opt/jbr/lib/hotswap
sudo curl -L -o /opt/jbr/lib/hotswap/hotswap-agent.jar https://github.com/HotswapProjects/HotswapAgent/releases/download/RELEASE-2.0.5/hotswap-agent-2.0.5.jar
Version 2.0.5 was the latest release when this was written; check the HotswapAgent releases page and adjust the URL if a newer one exists.
Step 4: Verify the installation
/opt/jbr/bin/java -XX:+AllowEnhancedClassRedefinition -version
The output should name the JetBrains build and print no error about an unrecognised option. A standard OpenJDK rejects this flag, which is a quick way to tell the two apart:
java -XX:+AllowEnhancedClassRedefinition -version
Step 5: Run your application with hot swapping
Start the application with enhanced redefinition, the agent, and a debug port bound to the loopback interface only:
/opt/jbr/bin/java \
-XX:+AllowEnhancedClassRedefinition \
-XX:HotswapAgent=fatjar \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005 \
-jar app.jar
-XX:+AllowEnhancedClassRedefinitionenables DCEVM. It must be set explicitly.-XX:HotswapAgent=fatjarloadslib/hotswap/hotswap-agent.jarwith all plugins.coreloads the agent without plugins, andexternallets you pass your own copy with-javaagent:/path/to/hotswap-agent.jar.- The
jdwpoption opens the debugger port that your IDE uses to push changed classes.
When the agent is active, the application log starts with lines prefixed HOTSWAP AGENT.
Step 6: Connect your IDE through an SSH tunnel
The debug port allows arbitrary code execution in the JVM, so never bind it to a public address or open it in the firewall. Forward it over SSH from your workstation instead:
ssh -N -L 5005:127.0.0.1:5005 deploy@203.0.113.10
Then create a "Remote JVM Debug" configuration in your IDE that attaches to localhost:5005. After you recompile a class, the IDE's reload-classes action sends it to the server and DCEVM applies it to the running process.
Maintenance and troubleshooting
- Unrecognized VM option 'AllowEnhancedClassRedefinition': you started the system
java, not/opt/jbr/bin/java. - No HOTSWAP AGENT lines: check that the file is at
/opt/jbr/lib/hotswap/hotswap-agent.jarwith exactly that name, and that-XX:HotswapAgentis on the command line. - Updates: JBR is not managed by
apt. To update, download a newer archive, unpack it to a new directory, copylib/hotswapacross and switch your start command. The Debian OpenJDK keeps receiving security updates throughapt upgrade. - Agent settings: HotswapAgent reads an optional
hotswap-agent.propertiesfile from the application's classpath, for example to disable individual plugins.
Reference: the JetBrains Runtime and HotswapAgent project pages.
Frequently asked questions
Can I still install Java 8 with DCEVM on Debian?
Not from Debian's repositories. Debian 12 does not ship OpenJDK 8 and has no DCEVM package. The HotswapAgent project still documents the legacy jdk8-dcevm builds, but they are not updated like current JDKs. If the application can run on Java 17 or newer, use JetBrains Runtime.
What can a normal JDK hot-swap without DCEVM?
Standard HotSpot only accepts changes to method bodies. Adding or removing methods and fields or otherwise changing a class's structure is rejected. DCEVM lifts those restrictions, which is why it needs a patched VM.
Do I need HotswapAgent if I already have DCEVM?
For plain Java code, DCEVM plus your IDE's debugger is enough. HotswapAgent matters when frameworks cache class metadata, for example Spring bean definitions or Hibernate mappings, which must be refreshed after a class changes.
Is JetBrains Runtime a drop-in replacement for OpenJDK?
It is built from OpenJDK sources with JetBrains patches, and it runs ordinary Java applications. It is published mainly for JetBrains IDEs, though, so keep the distribution's OpenJDK for production services and use JBR where you need hot reloading.