Running and Debugging
Running from the Command Line
SwingBridge requires special JVM flags to access internal Java modules. Because of this, running the application by clicking the green play button in IntelliJ IDEA or the equivalent in VS Code is not supported at this time.
To run the application, use Maven from the command line as described in Getting Started (skeleton starter) or Installation (from-scratch project).
|
Note
|
Hotswap Agent and Spring Boot DevTools automatic restart are not fully supported with SwingBridge yet. If you detect unexpected behavior, try running the application without them. |
Remote Debugging
After starting the application through Maven, you can debug it using remote debugging. The skeleton starter project already includes the necessary JVM argument for this. If you set up from scratch, add the following to the <jvmArguments> section in your spring-boot-maven-plugin configuration:
Source code
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005For IDE-specific setup instructions, see IntelliJ IDEA and VS Code below.
IDE Remote Debug Configuration
IntelliJ IDEA
To set up remote debugging in IntelliJ IDEA:
-
Open .
-
Click the + button and select Remote JVM Debug.
-
Set the Name to something descriptive, such as
SwingBridge Remote Debug. -
Ensure Debugger mode is set to Attach to remote JVM.
-
Set Host to
localhostand Port to5005. -
Click OK to save the configuration.
Start the application through Maven first, then launch this debug configuration. The debugger attaches to the running application, and you can set breakpoints and step through code as usual.
VS Code
To set up remote debugging in VS Code:
-
Open or create the
.vscode/launch.jsonfile in your project. -
Add the following configuration:
Source code
JSON
{ "type": "java", "name": "SwingBridge Remote Debug", "request": "attach", "hostName": "localhost", "port": 5005 } -
Start the application through Maven first.
-
Open the Run and Debug view and select SwingBridge Remote Debug.
-
Click the green play button to attach the debugger.
You can now set breakpoints and debug the running application.