redefine_classes
Hot-swap modified Java classes into a running JVM debug session to apply code changes without restarting. Scans compiled .class files and updates loaded classes via JDI.
Instructions
Hot-swap changed Java classes into a running JVM. Scans a classes directory for .class files modified after sinceTimestamp, matches them against loaded classes in the target JVM, and redefines them using JDI. Returns which classes were redefined and the newest file timestamp (pass as sinceTimestamp on next call for incremental updates). Statement-anchored breakpoints are re-resolved against the new source after the swap (anchorResolution reports moved/stale). Only works with Java debug sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | Max time (ms) to wait for the redefinition to complete (default: 30000, max: 600000). Increase when hot-swapping many classes at once | |
| sessionId | Yes | ||
| classesDir | Yes | Absolute path to compiled classes directory (e.g. build/classes/java/main/) | |
| sinceTimestamp | No | Unix timestamp (ms). Only redefine .class files modified after this time. 0 or omitted = all files. |