More desktop applications are adopting web-based user interfaces to combine the flexibility of modern web development with the native performance and system integration of desktop software.
In this article, we look at a Java desktop architecture built with Vue.js, Tailwind CSS, Fuzio, and gRPC/Protobuf.
Web UI vs. Native UI
Native desktop toolkits often require substantial custom engineering to achieve modern animations, high-DPI polish, and flexible light/dark theming. Web UIs benefit from a vast component ecosystem and consistent cross-OS styling, while wrapping them in a native Java host restores full filesystem access, OS integration, and offline execution.
Application Overview
The application embeds a Vue.js + Shadcn UI inside a native Java host window:
- Consistent UI across Windows, macOS, Linux, and Kylin OS
- Responsive web-grade interactions
- Offline execution with all frontend assets bundled inside the application
Window and Web View Setup
The host window uses Swing JFrame with Fuzio’s BrowserView:
var engine = Engine.newInstance(HARDWARE_ACCELERATED);
var browser = engine.newBrowser();
SwingUtilities.invokeLater(() -> {
var view = BrowserView.newInstance(browser);
var frame = new JFrame("Application");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
engine.close();
}
});
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.add(view, BorderLayout.CENTER);
frame.setSize(1280, 900);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
Loading the Web UI
Development
In development, point the embedded browser to your local Vue dev server for hot reload without rebuilding Java:
./gradlew desktop-web-app:startDevServer -Pfrontend=vue
if (!AppDetails.isProduction()) {
browser.navigation().loadUrl("http://localhost");
} else {
...
}
Production
In production, running a local HTTP server adds complexity and lets external browsers inspect local URLs. Instead, bundle the compiled Vue assets into your JAR and serve them via Fuzio’s custom protocol interceptor:
var options = EngineOptions.newBuilder(HARDWARE_ACCELERATED)
.addScheme(Scheme.of("fuzio"), new UrlRequestInterceptor());
var engine = Engine.newInstance(options.build());
With custom schemes:
- All HTML, CSS, and JS files are served directly from classpath resources
- No local HTTP server is required
- Source assets remain encapsulated inside the application package
Communicating Between Vue.js and Java
Fuzio JavaScript–Java Bridge
Expose Java objects to JavaScript using @JsAccessible:
@JsAccessible
class PrefsService {
void setFontSize(int size) {
}
}
declare class PrefsService {
setFontSize(size: number): void;
}
declare const prefsService: PrefsService;
...
prefsService.setFontSize(12);
Protobuf + gRPC
For strongly typed, scalable communication across complex APIs, define schemas in .proto files to generate Java server and TypeScript client bindings:
service PrefsService {
rpc SetFontSize(FontSize) returns (google.protobuf.Empty);
}
enum FontSize {
SMALL = 0;
DEFAULT = 1;
LARGE = 2;
}
This provides end-to-end type safety, build-time autocompletion, and clean API evolution as the application grows.
Summary
Combining Java with a Vue.js + Tailwind CSS frontend via Fuzio delivers:
- Embedded Chromium rendering inside a native Java window
- Seamless dev-server and offline packaged asset loading
- Type-safe Java↔Vue communication with the JS bridge or gRPC/Protobuf
Add a Chromium-based browser engine to your Java desktop app with Fuzio.
Try for free

