|
1 | | - |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -**Webswing** is a web server that allows you to run any Java swing application inside your web browser using only pure HTML5. |
| 3 | +# WebSwing Lite |
4 | 4 |
|
5 | | -The best days of swing framework are gone. Desktop applications lost popularity and everything is forced to be online and mobile. But what about existing application? Using applet technology proved to be insecure, and rewriting the application to web is too expensive. This is where Webswing can help you. With Webswing, your application is securely running on a server and a user's browser only displays the application window. All this without changing a single line of source code. |
| 5 | +### Enterprise Java Swing Applications — Delivered Through Your Browser |
6 | 6 |
|
7 | | -## Attribution |
| 7 | +[](https://github.com/manticore-projects/webswing/actions/workflows/Gradle.yml) |
| 8 | +[](https://github.com/manticore-projects/webswing/releases) |
| 9 | +[](https://openjdk.org/) |
| 10 | +[](https://nodejs.org/) |
| 11 | +[](https://www.gnu.org/licenses/agpl-3.0) |
| 12 | +[](https://gradle.org/) |
| 13 | +[](https://github.com/manticore-projects/webswing) |
| 14 | + |
| 15 | +<br/> |
| 16 | + |
| 17 | +*Run any Java Swing application inside a modern web browser — pure HTML5, zero plugins, zero client-side installation.* |
| 18 | + |
| 19 | +<br/> |
| 20 | + |
| 21 | +[Getting Started](#-getting-started) · [Build](#-build-instructions) · [What's New](#-whats-new) · [Architecture](#-architecture) · [Commercial Edition](#-commercial-edition) |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +</div> |
| 26 | + |
| 27 | +## Overview |
| 28 | + |
| 29 | +**WebSwing Lite** is a modernized, open-source edition of [WebSwing](https://www.webswing.org) — the web server that renders Java Swing applications in HTML5 Canvas and delivers them to any browser via WebSocket. |
| 30 | + |
| 31 | +This edition is based on the **last open-source release (v20.2.5)** of WebSwing, updated and maintained by [Manticore Projects](https://github.com/manticore-projects) with a focus on **modern JDK compatibility**, **security**, and **build toolchain modernization**. |
| 32 | + |
| 33 | +> **Looking for the full-featured commercial edition?** |
| 34 | +> WebSwing Lite does not include advanced capabilities such as cluster session pooling, load balancing, recording/playback, advanced admin console, and commercial support. |
| 35 | +> For production deployments at scale, we encourage you to explore the [**Commercial Edition at webswing.org**](https://www.webswing.org) → |
| 36 | +
|
| 37 | +--- |
| 38 | + |
| 39 | +## ✦ What's New |
| 40 | + |
| 41 | +### JDK Compatibility |
| 42 | + |
| 43 | +| JDK | Status | Notes | |
| 44 | +|:---:|:------:|:------| |
| 45 | +| 13–17 | 🔶 Should work | Untested — community feedback welcome | |
| 46 | +| 21 (LTS) | ✅ Fully supported | Primary target | |
| 47 | +| 23 | ✅ Supported | Short-term release | |
| 48 | +| 25 (LTS) | ✅ Supported | Current LTS | |
| 49 | +| 26 | ✅ Supported | Requires `--sun-misc-unsafe-memory-access=allow` | |
| 50 | + |
| 51 | +All internal APIs adapted for the post-JDK-11 module system — no `--illegal-access=permit`, no `-noverify` required. |
| 52 | + |
| 53 | +### Build & Runtime Modernization |
| 54 | + |
| 55 | +- **Node.js 24 LTS** — migrated from Node 10; Webpack 5, TypeScript 5, Dart Sass |
| 56 | +- **Gradle build system** — fast, incremental builds alongside the existing Maven build (Maven will be phased out in a future release) |
| 57 | +- **All dependencies updated** — Jackson, Guava, Log4j2, SLF4J 2.0, Bouncy Castle, Apache Commons, Protocol Buffers, and more |
| 58 | +- **Modernized start/stop script** — `bash` strict mode, graceful shutdown with timeout, Xvfb lifecycle management, clean log rotation |
| 59 | + |
| 60 | +### Performance |
| 61 | + |
| 62 | +- **SSE/AVX-optimized PNG encoding** via [fpng-java](https://github.com/nicob/fpng-java) — hardware-accelerated image compression in the DirectDraw rendering pipeline |
| 63 | +- **Browser-side font rendering** — text is rendered as font names + coordinates instead of server-side glyph bitmaps, reducing WebSocket bandwidth by up to 80% |
| 64 | + |
| 65 | +### Security |
| 66 | + |
| 67 | +- **Apache Shiro integration** — pluggable authentication and authorization supporting Active Directory / LDAP, JDBC realms, and custom providers |
| 68 | +- **TLS/SSL** — full HTTPS and WSS support with configurable keystores and truststores |
| 69 | + |
| 70 | +### Roadmap |
| 71 | + |
| 72 | +- Migration to **Jetty 12** (EE8 environment for `javax.servlet` compatibility) |
| 73 | +- Migration to **Apache HttpClient 5** replacing the legacy 4.x client |
| 74 | +- `PlatformGraphicsInfo` module patch integrated into the build system (replacing the runtime `Unsafe` workaround) |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## 🚀 Getting Started |
| 79 | + |
| 80 | +### Prerequisites |
| 81 | + |
| 82 | +| Component | Version | |
| 83 | +|-----------|---------| |
| 84 | +| JDK | 13 or later (21+ recommended; [Eclipse Temurin](https://adoptium.net/)) | |
| 85 | +| Xvfb | Required on headless Linux servers | |
8 | 86 |
|
9 | | -In case you are using Webswing to deliver your product **give a credit and a create link on your page to webswing.org!** |
| 87 | +### Quick Start |
10 | 88 |
|
11 | | -## Contribution |
| 89 | +```bash |
| 90 | +# Download the latest release |
| 91 | +curl -LO https://github.com/manticore-projects/webswing/releases/latest/download/webswing-26.0-distribution.zip |
| 92 | +unzip webswing-26.0-distribution.zip |
| 93 | +cd webswing-26.0 |
12 | 94 |
|
13 | | -If you want to contribute to Webswing, be sure to review the [contribution guidelines](http://webswing.org/docs/version-2.5/contrib/). |
14 | | -We use [bitbucket issues](https://bitbucket.org/meszarv/webswing/issues) for tracking requests and bugs. |
| 95 | +# Start the server |
| 96 | +./run.sh start |
15 | 97 |
|
16 | | -## Links |
| 98 | +# Open in your browser |
| 99 | +open http://localhost:8080 |
| 100 | +``` |
17 | 101 |
|
18 | | -[Webswing Website](https://www.webswing.org) |
| 102 | +### Management |
19 | 103 |
|
20 | | -[Documentation](https://webswing.org/docs/) |
| 104 | +```bash |
| 105 | +./run.sh start # Start the server (background, with log tailing) |
| 106 | +./run.sh stop # Graceful shutdown (30s timeout, then SIGKILL) |
| 107 | +./run.sh restart # Stop + Start |
| 108 | +./run.sh status # Check if the server is running |
| 109 | +``` |
21 | 110 |
|
22 | | -[Downloads](https://www.webswing.org/downloads) |
| 111 | +--- |
23 | 112 |
|
24 | | -[Webswing Promo Video - Youtube](https://youtu.be/IpYlyCRZcxc) |
| 113 | +## 🔨 Build Instructions |
25 | 114 |
|
26 | | -[Webswing Quickstart Guide Video - Youtube](https://youtu.be/TKFJEfBBpKI) |
| 115 | +### Prerequisites |
| 116 | + |
| 117 | +| Tool | Version | |
| 118 | +|--------|---------| |
| 119 | +| JDK | 21+ | |
| 120 | +| Gradle | 8.12 | |
| 121 | +| Git | 2.x | |
| 122 | + |
| 123 | +> Node.js and npm are **automatically downloaded** during the build — no manual installation needed. |
| 124 | +
|
| 125 | +### Build with Gradle |
| 126 | + |
| 127 | +```bash |
| 128 | +# Clone the repository |
| 129 | +git clone https://github.com/manticore-projects/webswing.git |
| 130 | +cd webswing |
| 131 | + |
| 132 | +# Full build |
| 133 | +./gradlew clean build |
| 134 | + |
| 135 | +# Build specific modules |
| 136 | +./gradlew :webswing-directdraw:webswing-directdraw-javascript:build |
| 137 | +./gradlew :webswing-server:webswing-server-frontend:build |
| 138 | +``` |
| 139 | + |
| 140 | +### Deploy |
| 141 | + |
| 142 | +```bash |
| 143 | +# Extract to your deployment directory |
| 144 | +unzip webswing-assembly/dist/webswing-26.0-distribution.zip -d /opt/webswing |
| 145 | + |
| 146 | +# Configure your Swing application in webswing.config |
| 147 | +vim /opt/webswing/webswing.config |
| 148 | + |
| 149 | +# Start |
| 150 | +cd /opt/webswing && ./run.sh start |
| 151 | +``` |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## 🏗 Architecture |
| 156 | + |
| 157 | +``` |
| 158 | +┌─────────────────────────────────────────────────────────────┐ |
| 159 | +│ Browser │ |
| 160 | +│ ┌───────────────────────────────────────────────────────┐ │ |
| 161 | +│ │ HTML5 Canvas ◄──── WebSocket ────► Event Capture │ │ |
| 162 | +│ └───────────────────────────────────────────────────────┘ │ |
| 163 | +└─────────────────────────────────┬───────────────────────────┘ |
| 164 | + │ |
| 165 | + ┌─────────────▼─────────────┐ |
| 166 | + │ WebSwing Server │ |
| 167 | + │ (Jetty 9 / Servlet) │ |
| 168 | + │ │ |
| 169 | + │ ┌──────────────────────┐ │ |
| 170 | + │ │ Session Manager │ │ |
| 171 | + │ │ Security (Shiro) │ │ |
| 172 | + │ │ WebSocket Handler │ │ |
| 173 | + │ └──────────┬───────────┘ │ |
| 174 | + └─────────────┼──────────────┘ |
| 175 | + │ spawns |
| 176 | + ┌─────────────▼─────────────┐ |
| 177 | + │ Child JVM Process │ |
| 178 | + │ │ |
| 179 | + │ ┌──────────────────────┐ │ |
| 180 | + │ │ WebToolkit (AWT) │ │ |
| 181 | + │ │ DirectDraw Pipeline │ │ |
| 182 | + │ │ Font Renderer │ │ |
| 183 | + │ │ ────────────────── │ │ |
| 184 | + │ │ Your Swing App │ │ |
| 185 | + │ └──────────────────────┘ │ |
| 186 | + └────────────────────────────┘ |
| 187 | +``` |
| 188 | + |
| 189 | +**How it works:** The server intercepts Java2D `Graphics2D` paint operations in the child JVM, serializes them via Protocol Buffers, and streams them over WebSocket to the browser. The browser's JavaScript engine deserializes and replays the draw commands on an HTML5 Canvas. User input (mouse, keyboard) flows back over the same WebSocket. |
| 190 | + |
| 191 | +--- |
| 192 | + |
| 193 | +## 📦 Dependency Overview |
| 194 | + |
| 195 | +| Component | Version | Purpose | |
| 196 | +|-----------|---------|---------| |
| 197 | +| Jetty | 9.4.58 | Embedded HTTP/WebSocket server | |
| 198 | +| Jackson | 2.19.0 | JSON serialization | |
| 199 | +| Protocol Buffers | 3.25.5 | Binary wire format (DirectDraw) | |
| 200 | +| Apache Shiro | 1.13.0 | Authentication & authorization | |
| 201 | +| Guava | 33.5.0 | Core utilities | |
| 202 | +| Log4j 2 | 2.25.3 | Logging framework | |
| 203 | +| SLF4J | 2.0.17 | Logging facade | |
| 204 | +| Bouncy Castle | 1.80 | Cryptography | |
| 205 | +| Webpack | 5.x | JavaScript bundling | |
| 206 | +| TypeScript | 5.x | Type-safe frontend code | |
| 207 | + |
| 208 | + |
| 209 | +--- |
| 210 | + |
| 211 | +## Attribution |
| 212 | + |
| 213 | +This project is based on [WebSwing](https://www.webswing.org) v20.2.5, the last open-source release under the AGPL v3 license. All credit for the original WebSwing architecture and implementation goes to the WebSwing team. |
| 214 | + |
| 215 | +If you use WebSwing Lite to deliver your product, **please provide attribution and a link to [webswing.org](https://www.webswing.org).** |
27 | 216 |
|
28 | 217 | ## License |
29 | 218 |
|
30 | | -[GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) |
| 219 | +This project is licensed under the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html). |
| 220 | + |
| 221 | +--- |
| 222 | + |
| 223 | +<div align="center"> |
| 224 | + |
| 225 | +**Maintained by [Manticore Projects](https://github.com/manticore-projects)** |
| 226 | + |
| 227 | +*Building enterprise financial software for banks and insurances since 2014.* |
| 228 | + |
| 229 | +</div> |
0 commit comments