Debugging
Debugging is an essential part of Java development, helping developers identify and fix issues efficiently. This guide explains how to configure debugging in webforJ for Visual Studio Code, IntelliJ IDEA, and Eclipse.
- Visual Studio Code
- IntelliJ IDEA
- Eclipse
- Open your webforJ project in VS Code.
- Press Ctrl + Shift + D (or Cmd + Shift + D on Mac) to open the Run and Debug panel.
- Click "create a launch.json file"
- Select Java as the environment.
- Modify
launch.json
to match the following:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Attach to Jetty",
"request": "attach",
"hostName": "localhost",
"port": 8000
}
]
}
- Save the file and click Start Debugging.
- Open your project in IntelliJ IDEA.
- Navigate to Run → Edit Configurations.
- Click the + button and select Remote JVM Debug.
- Set the host to
localhost
and port to8000
. - Save the configuration and click Debug to attach to the running app.
- Open your project in Eclipse.
- Go to Run → Edit Configurations.
- Select Remote Java Application.
- Click New Configuration and set:
- Host:
localhost
- Port:
8000
- Host:
- Save and start the debugger.
Running the debugger
Once you’ve configured your IDE:
- Start your webforJ app using
mvnDebug jetty:run
. - Run the debug configuration in your IDE.
- Set breakpoints and begin debugging
Debugging Tips
- Ensure port 8000 is available and not blocked by any firewall.
- If you are using any of the webforJ archetypes and have changed the port number in the pom.xml file, make sure the port used for debugging matches the updated value.