Debugging Java
Client .java files run inside the same JVM as the platform, so the standard JDWP attach works. The IDE bridges JDT.LS's DAP server to the platform's JDWP port, surfacing call stack, variables, watch, and breakpoints in the Java debugger view.
Prerequisites
- JDWP must be enabled on the platform JVM. The official Docker image is preconfigured.
- The JDWP port is
8000(envDIRIGIBLE_JAVA_DEBUG_JDWP_PORT). - The Java debugger view itself is workspace-scoped - one bridge per
(user, workspace).
Workflow
- Open a
.javafile in Monaco. - Click in the gutter - a red dot marks the breakpoint.
- Switch to the Java debugger view and press Attach.
- Status flips through a "connecting…" animation, then connected.
- Hit the endpoint that runs your class. The JVM pauses; the call stack, variables, and breakpoints panels populate.
- Step (over / into / out), continue, or disconnect.
Architecture in brief
Browser (debug.js) <-WebSocket-> JavaDebugWebSocketHandler
v JavaDebugManager
v JavaDebugBridge (per workspace)
v DAP TCP socket
JDT.LS (vscode.java.startDebugSession)
v JDWP TCP (port 8000)
Target JVMJavaDebugManagerholds a singletonJavaDebugBridgeper(username, workspace)key.- Path translation rewrites virtual workspace paths (
/workspace/proj/Foo.java) to absolute on-disk paths and back. - Disconnect sends
terminateDebuggee:falseso the JDWP port stays attachable for the next session.
Breakpoints persistence
The view stores breakpoints in localStorage['dirigible.java.debug.breakpoints'] as a { virtualPath -> int[] } map. Restored on view load; broadcast to open editors via the java.debug.breakpoints topic.
When the debugger fails to attach
- "unknown command" from DAP -
com.microsoft.java.debug.plugin-*.jaris missing from the JDT.LSplugins/directory or itsconfig_<platform>/config.iniosgi.bundlesentry.JdtLsManager.installDebugPlugin()is supposed to install both. - 60-second
ensureInitializedtimeout - the JDT.LS server hasn't receivedinitialize/initializedyet. Restart it from the Operations perspective. - "Address already in use" on port 8000 - another process is bound to JDWP. Change the port via
DIRIGIBLE_JAVA_DEBUG_JDWP_PORT.