-
Notifications
You must be signed in to change notification settings - Fork 397
No Config Debug
wenyt edited this page Nov 3, 2025
·
2 revisions
This feature enables configuration-less debugging for Java applications, similar to the JavaScript Debug Terminal in VS Code.

When you open a terminal in VS Code with this extension installed, the following environment variables are automatically set:
-
VSCODE_JDWP_ADAPTER_ENDPOINTS: Path to a communication file for port exchange -
PATH: Includes thedebugjavacommand wrapper
Note: JAVA_TOOL_OPTIONS is NOT set globally to avoid affecting other Java tools (javac, maven, gradle). Instead, it's set only when you run the debugjava command.
Instead of running:
java -cp . com.example.MainSimply run:
debugjava -cp . com.example.MainThe debugger will automatically attach, and breakpoints will work without any launch.json configuration!
debugjava -jar target/myapp.jardebugjava -jar build/libs/myapp.jardebugjava -cp . com.example.Main arg1 arg2 --flag=valuedebugjava -jar myapp.jar --spring.profiles.active=dev- No Configuration Required: No need to create or maintain launch.json
- Rapid Prototyping: Perfect for quick debugging sessions
- Script Debugging: Debug applications launched by complex shell scripts
- Environment Consistency: Inherits all terminal environment variables
- Parameter Flexibility: Easy to change arguments using terminal history (↑ key)
- When you run
debugjava, the wrapper script temporarily setsJAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0 - The wrapper determines which Java executable to use (priority order):
- First:
JAVA_HOME/bin/javaif JAVA_HOME environment variable is set (user's explicit choice) - Second:
VSCODE_JAVA_EXECenvironment variable (Java path from VS Code's Java Language Server) - Third:
javacommand from system PATH
- First:
- The wrapper launches the Java process with JDWP enabled
- JVM starts and outputs: "Listening for transport dt_socket at address: 12345"
- The wrapper captures the JDWP port from this output
- The port is written to a communication file
- VS Code's file watcher detects the file and automatically starts an attach debug session
If you see "Address already in use", another Java debug session is running. Terminate it first.
- Ensure you're running with
debugjavacommand (not plainjava) - Check that the
debugjavacommand is available:which debugjava(Unix) orGet-Command debugjava(PowerShell) - Verify the terminal was opened AFTER the extension activated
- Check the Debug Console for error messages
The wrapper script requires Node.js to be installed and available in PATH.
- Requires Node.js to be installed and available in PATH
- Only works in terminals opened within VS Code
- Requires using the
debugjavacommand instead ofjava - The Java process will suspend (hang) until the debugger attaches