hot_reload
Apply Java code changes to a running Swing application without restarting it. Reloads changed classes and rebuilds affected screens, keeping state when possible.
Instructions
Apply code changes to the running application without restarting it. Workflow: edit the Java sources, compile them (e.g. mvn -q compile in the application's module, or let the IDE build), then call hot_reload. Changed classes are found in the class directories (target/classes) and loaded into the running JVM. If only event handlers, painting or business logic changed, open screens keep their state; if a screen's construction code changed (constructor, initComponents, @PostConstruct...), that screen is rebuilt. Changes that add or remove methods or fields (including new lambdas) cannot be applied on a standard JVM: the result explains which, and nothing is changed; then restart the application. Only classes whose code really changed are reloaded, even if the build rewrote all class files. In a multi-module project, a module that the application runs from its jar needs classesDir (or start the application with mvn swing2mcp:run -Dswing2mcp.classesDirs=...). Returns the new snapshot.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "hot_reload"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| refs | No | Refs of screens to rebuild in any case | |
| rebuild | No | auto (default): rebuild screens whose construction code changed; all: rebuild every open screen of a reloaded class; none: never | |
| classesDir | No | Directory with compiled classes, if the application was not started from it (e.g. a module that runs from its jar) |