Configuration
This page lists the runtime knobs SwingBridge reads from JVM system properties, plus the in‑page error view that activates when the embedded Swing application fails to launch.
System Properties Reference
Every parameter below is a JVM system property. None of them is required except java.awt.headless; the defaults are chosen so that a deployment can leave all of them unset.
Core
| Property | Default | Description |
|---|---|---|
| — | Required. Must be set to |
|
| Override the directory SwingBridge scans for application JARs. See Using the |
| JVM working directory ( | Base directory used to resolve relative paths in |
| — | NetBeans RCP only. Absolute path to a pre-built NetBeans Platform distribution directory; the highest-priority discovery source for |
|
| When set to |
Display and Rendering
These decide what the Swing application is told about the screen and how each window’s back buffer is allocated. See Display and Rendering for the accepted values and what they do.
| Property | Default | Description |
|---|---|---|
|
| The screen size reported to the Swing application: derived from each session’s own browser, or a fixed |
|
| Renders the back buffer at the browser’s device pixel ratio, for crisp text on Retina and 4K displays. |
|
| Upper bound on the HiDPI multiplier, between |
|
| Upper bound on a single window’s back buffer, in device pixels. |
|
| Pixel format of each window’s back buffer: |
Input
| Property | Default | Description |
|---|---|---|
|
| The canvas adopts browser focus when it appears, so keystrokes reach the Swing application without the user clicking it first. It only takes focus when nobody else is using it — an unfocused page, another surface of the same bridge, or the navigation control that brought the user to the view; fields and buttons keep their focus, and popup, combo-popup and tooltip canvases never adopt focus at all. Set to |
|
| How many pixels of browser wheel delta count as one Swing line-scroll step, for browsers that report pixel deltas. The fractional remainder is carried per window so high-resolution wheels and trackpads scroll smoothly. A blank, non-numeric or non-positive value falls back to the default. Read once at startup. |
|
| How often SwingBridge polls each Swing window for changes and pushes the dirty regions to the browser. Lower values feel more responsive at the cost of CPU; higher values save CPU at the cost of perceived latency. |
Logging
See Logging & Identifying Logs per User for the full picture, including the pattern-layout tokens.
| Property | Default | Description |
|---|---|---|
|
| When set to |
| — | Path to a file that receives a copy of the prefixed console output, for when the server console itself is not retained. |
|
| When set to |
| None | Not set by the operator: an embedded Swing application sets this property at runtime, after its own login, to publish the authenticated user’s name for log attribution. The value is routed per session, so concurrent users can’t overwrite each other. See Adding the User’s Name to the Logs. |
For Spring Boot, set system properties through <systemPropertyVariables> on the spring-boot-maven-plugin (see Project Setup) or pass -D flags on the command line. For a packaged JAR, pass them with -D on the command line:
Source code
terminal
java -Dswingbridge.errorReporting.enabled=false -jar my-app.jarJVM Tuning for Multiple Sessions
SwingBridge runs every browser session’s Swing application inside one JVM, so the host’s garbage-collector settings decide how much memory a given number of concurrent sessions needs. The library cannot set these for you — they belong to the host application’s launch configuration, alongside the flags in JVM Flags Reference.
The defaults are fine for a handful of sessions. The settings below matter when packing many sessions into one host.
| Flag | Why |
|---|---|
| Concurrent sessions of the same application load the same strings repeatedly. G1’s string deduplication is close to free here and reduces the live set. |
| G1 as configured by default does not return a drained session’s heap to the operating system: committed heap grows and stays pinned, and an explicit |
| An alternative when sessions are bursty and memory should come back promptly as they end: sub-millisecond pause times and prompt uncommit. Because it collects concurrently it needs allocation headroom, so budget close to |
|
Caution
|
ZGC is a poor fit for this workload. It has the highest peak footprint of the collectors measured and a large fixed metadata overhead, so its idle resident size lands above untuned G1 despite returning the most memory in absolute terms. It is a large-heap collector, and a host running many small Swing sessions is not that regime. |
Which of these pays off depends on the Swing application and on how many sessions a host carries, so measure against your own application before adopting one as a default.
Launch Failure Error View
When a Swing application embedded via SwingBridge fails to start — for example because the configured main class cannot be loaded, the AWT toolkit cannot initialize, or no JFrame becomes visible within the launch timeout — the canvas area is replaced with an in-page error view that shows:
-
A failure title and a short explainer.
-
The error type and message.
-
The full stack trace, including any
Caused bychain (collapsible). -
An optional email field and a Submit report button that posts a report to Vaadin so the cause can be investigated.
-
A Preview report content button that opens a draggable, resizable dialog showing the exact JSON that would be submitted (with the stack trace rendered as plain text in a separate section).
-
A link to the Vaadin Privacy Policy explaining how reports are processed.
Disabling for Production
Set swingbridge.errorReporting.enabled=false to suppress all exception details in the error view. Only the Failed to launch the Swing application header is shown; the message, stack trace, email field, and submit button are all hidden so that no diagnostic information leaks into the page or onto a report endpoint. Diagnose the cause from server-side logs instead.
For a Spring Boot run, add the flag to the <jvmArguments> in spring-boot-maven-plugin. For a packaged JAR:
Source code
terminal
java -Dswingbridge.errorReporting.enabled=false -jar my-app.jar|
Important
|
Stack traces can contain sensitive data (file paths, hostnames, query parameters). Disable error reporting in any deployment where this information must not reach end-users or third parties. |