Overview
Compose Hot Reload requires JetBrains Runtime (JBR) to function. This page explains why JBR is necessary, how to obtain it, and how to configure it for your project.Why JetBrains Runtime?
JetBrains Runtime is a fork of OpenJDK that includes enhanced class redefinition capabilities necessary for hot reload to work.Standard JDK Limitations
The standard JDK’s HotSwap feature has severe restrictions:- ❌ Can only redefine method bodies
- ❌ Cannot add or remove methods
- ❌ Cannot add or remove fields
- ❌ Cannot change method signatures
- ❌ Cannot modify class hierarchy (superclass, interfaces)
- ❌ Cannot change class modifiers (e.g.,
publictoprivate)
JetBrains Runtime Capabilities (DCEVM)
JetBrains Runtime includes Dynamic Code Evolution VM (DCEVM), which enables:- ✅ Add/remove methods - Define new functions or delete existing ones
- ✅ Add/remove fields - Add new properties or remove old ones
- ✅ Change method signatures - Modify parameters, return types
- ✅ Modify class hierarchy - Change superclass and interfaces (with some limitations)
- ✅ Change class modifiers - Update visibility and other modifiers
- ✅ Redefine enum values - Add or remove enum constants (with limitations)
Enhanced Class Redefinition
JBR’s enhanced redefinition is enabled via:- Only available in JetBrains Runtime
- Automatically added by the Compose Hot Reload Gradle plugin
- Required for hot reload to work
Obtaining JetBrains Runtime
There are multiple ways to obtain JBR, with automatic fallback if one method fails.Method 1: Automatic Provisioning (Experimental)
The Gradle plugin can automatically download and provision JBR. Enable ingradle.properties:
- Plugin detects your project’s Java target version
- Downloads matching JBR from JetBrains servers
- Extracts to Gradle user home:
~/.gradle/chr/jbr/ - Caches for reuse across projects
- Uses file locking to prevent concurrent downloads
- JBR 11 (Java 11)
- JBR 17 (Java 17)
- JBR 21 (Java 21) - Default
- JBR 25 (Java 25)
Automatic provisioning is experimental. If you encounter issues, please report them on GitHub.
- Zero manual setup
- Automatic version matching
- Shared across projects
- Requires internet connection (first time only)
- Experimental feature
- Limited control over exact build
Method 2: Gradle Toolchain with Foojay
Use Gradle’s toolchain support with the Foojay resolver to automatically download JBR. 1. Add foojay plugin tosettings.gradle.kts:
gradle.properties:
- Gradle’s toolchain service requests a JetBrains JVM
- Foojay resolver searches for matching JBR distributions
- Downloads from foojay.io (a JVM discovery service)
- Installs to Gradle’s toolchain directory
- Reused automatically for subsequent runs
- Uses standard Gradle mechanism
- Well-tested and stable
- Works for all Gradle tasks, not just hot reload
- Requires foojay plugin
- Less control over specific JBR builds
Method 3: IntelliJ IDEA Integration
When running hot reload from IntelliJ IDEA or Android Studio with the Kotlin Multiplatform plugin: The IDE automatically provides JBR:- IntelliJ bundles JetBrains Runtime
- Plugin detects the bundled JBR
- Passes JBR path to Gradle via system property
- Hot reload tasks use IDE’s JBR automatically
- IntelliJ IDEA 2025.2.2+ (any edition)
- Android Studio Otter 2025.2.1+
This is the recommended approach for most developers. Install a recent IDE and run hot reload from the gutter icon.
Method 4: Manual Configuration
You can manually download and configure JBR. 1. Download JBR: Visit the JetBrains Runtime GitHub releases and download a build for your platform:- Linux:
jbr-<version>-linux-x64.tar.gz - macOS:
jbr-<version>-osx-x64.tar.gz(Intel) orjbr-<version>-osx-aarch64.tar.gz(Apple Silicon) - Windows:
jbr-<version>-windows-x64.tar.gz
- Full control over JBR version and build
- Can use custom or patched JBR builds
- Works offline
- Manual download and updates
- Must manage multiple versions for different projects
- Platform-specific setup
Java Version Compatibility
Your project must target Java 21 or earlier to be compatible with JetBrains Runtime.Checking Your Java Target
In build.gradle.kts:Supported Java Versions
| Java Version | JBR Support | Status |
|---|---|---|
| Java 8 | ⚠️ Limited | Not recommended |
| Java 11 | ✅ JBR 11 | Supported |
| Java 17 | ✅ JBR 17 | Supported |
| Java 21 | ✅ JBR 21 | Recommended |
| Java 25 | ✅ JBR 25 | Supported |
Java 21 with JBR 21 is the recommended configuration for the best compatibility and features.
Upgrading from Java 8/11
If your project uses Java 8 or 11: Update to Java 17 or 21:Resolution Order
The Gradle plugin searches for JBR in this order:- User-specified:
compose.reload.jbr.binaryproperty - Gradle toolchain: Foojay resolver with JetBrains vendor
- Auto-provisioned: Automatic download if enabled
- IntelliJ JBR: IDE-provided when running from IDEA
- Error: No suitable JBR found
Configuration Properties Reference
Gradle Properties
Set ingradle.properties:
System Properties
Pass at runtime:Environment Variables
Verifying JBR Installation
To confirm you’re using JetBrains Runtime: Check the console output when launching:Platform-Specific Notes
macOS
Unsigned binary warning: First time running manually installed JBR:aarch64 (ARM64) build for better performance:
x64 build:
Linux
Set executable permissions:Windows
Extract location: Extract to a path without spaces:Troubleshooting
”Failed to find suitable JetBrains Runtime”
Problem: No JBR found using any method. Solutions:-
Enable automatic provisioning:
-
Install foojay resolver:
- Run from IntelliJ IDEA with Kotlin Multiplatform plugin
- Manually download and configure JBR (see Method 4)
“Unrecognized VM option ‘AllowEnhancedClassRedefinition’”
Problem: You’re using a standard JDK instead of JBR. Solution: Install JetBrains Runtime using one of the methods above.”JBR version mismatch”
Problem: JBR version doesn’t match your Java target. Solution: Update JBR version to match:“Cannot download JBR” (Offline mode)
Problem: Automatic provisioning fails in offline mode. Solutions:- Download JBR manually before going offline
- Use IntelliJ’s bundled JBR (works offline)
- Disable automatic provisioning:
Best Practices
- Use IntelliJ IDEA for development - JBR is provided automatically
- Enable auto-provisioning for CI/CD environments:
- Match Java versions - Use JBR version that matches your target:
- Don’t commit JBR to version control - It’s large (~300MB)
- Document for team - Add setup instructions to your README
Summary
- JetBrains Runtime is required for Compose Hot Reload
- Standard JDK cannot perform enhanced class redefinition
- Multiple provisioning methods available (automatic, Gradle, manual)
- IntelliJ integration provides JBR automatically
- Java 21 with JBR 21 is the recommended configuration
- Target Java 21 or earlier for compatibility