Fuzio in SWT
This page describes how to configure a Gradle project to use Fuzio with the SWT GUI toolkit.
Prerequisites
- Git.
- Java 17 or higher.
- Fuzio license key, or a free trial key.
Getting the project
The sample project described below in this guide can be found as the standalone repository on Gitee.
Configuring the Gradle project
Repository
Fuzio is distributed via the maven repository hosted by Jiku. Please add the following repository reference to your build.gradle.kts:
repositories {
// The repository with Fuzio binaries.
maven("https://jiku.mycloudrepo.io/public/repositories/releases")
}
Version variable
We recommend to define a variable for the version of Fuzio used in the project. The following sections reference such a variable.
val fuzioVersion = "2026.1.0"
Platform
To add Fuzio library that works on Windows, macOS, and Linux, please add the following code:
dependencies {
implementation("tech.fuzio:fuzio-cross-platform:${fuzioVersion}")
}
SWT
To use Fuzio in the SWT GUI of your app, please add the corresponding Fuzio dependencies as well:
dependencies {
implementation("tech.fuzio:fuzio-swt:${fuzioVersion}")
}
SWT requires specifying the platform dependecies explicitly, so you need to import the implementation dependency for each specific platform you build and run your application:
val swtImplDependency = "${swtImplPrefix}.${swtOs()}.${swtArch()}:${swtVersion}"
dependencies {
implementation(swtImplDependency)
}
Also, using SWT with Gradle is not straightforward - you should use dependency substitution. Please see full buld.gradle.kts file in the summary section of this quick start.
Kotlin DSL
If you develop using Kotlin, then we recommend that you to add Fuzio Kotlin DSL for the best experience.
dependencies {
implementation("tech.fuzio:fuzio-kotlin:${fuzioVersion}")
}
Summary
Here’s how the build.gradle.kts file is configured:
plugins {
java
application
kotlin("jvm") version "2.0.0"
}
val fuzioVersion = "2026.1.0"
val swtVersion = "3.124.0"
repositories {
mavenCentral()
maven("https://repo1.maven.org/maven2")
maven("https://jiku.mycloudrepo.io/public/repositories/releases")
}
val swtOs = {
val os = System.getProperty("os.name").lowercase()
when {
os.contains("win") -> "win32.win32"
os.contains("linux") -> "gtk.linux"
os.contains("mac") -> "cocoa.macosx"
else -> {
throw IllegalStateException("Unexpected operating system")
}
}
}
val swtArch = {
val arch = System.getProperty("os.arch")
val isArm = "aarch64" == arch || "arm" == arch
when {
isArm -> "aarch64"
else -> "x86_64"
}
}
val swtImplPrefix = "org.eclipse.platform:org.eclipse.swt"
val swtImplDependency = "${swtImplPrefix}.${swtOs()}.${swtArch()}:${swtVersion}"
dependencies {
implementation("tech.fuzio:fuzio-cross-platform:${fuzioVersion}")
implementation("tech.fuzio:fuzio-swt:${fuzioVersion}")
implementation(kotlin("stdlib-jdk8"))
implementation("tech.fuzio:fuzio-kotlin:${fuzioVersion}")
implementation(swtImplDependency)
}
val osgiUnresolved = "\${osgi.platform}"
project.configurations.all {
resolutionStrategy {
dependencySubstitution {
substitute(module("${swtImplPrefix}.${osgiUnresolved}"))
.because("The Maven property osgi.platform is not handled by Gradle")
.using(module(swtImplDependency))
}
}
}
kotlin {
jvmToolchain(17)
}
application {
// Define the main class for the application.
mainClass.set("SwtApp")
// Alternatively, you can run a Kotlin example, as follows:
//mainClass.set("KotlinSwtApp")
}
tasks.withType<JavaExec> {
if (os.contains("mac")) {
jvmArgs(
// For macOS to run SWT under Cocoa.
"-XstartOnFirstThread"
)
}
// Assign all Java system properties from
// the command line to the JavaExec task.
systemProperties(System.getProperties().mapKeys { it.key as String })
}
Embedding Fuzio into SWT
There are two SWT app implementations in the project: Java and Kotlin.
Both implementations are similar and demonstrate how to:
- Initialize an engine (Chromium) instance.
- Create a browser instance.
- Load the required web page.
- Embed a
BrowserViewcomponent into an SWT shell to display the loaded web page.
// SwtApp.java
import static tech.fuzio.engine.RenderingMode.HARDWARE_ACCELERATED;
import tech.fuzio.engine.Engine;
import tech.fuzio.view.swt.BrowserView;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public final class SwtApp {
public static void main(String[] args) {
// Initialize Chromium.
var engine = Engine.newInstance(HARDWARE_ACCELERATED);
// Create a Browser instance.
var browser = engine.newBrowser();
// Load the required web page.
browser.navigation().loadUrl("https://html5test.jiku.co");
var display = new Display();
var shell = new Shell(display);
shell.setText("Fuzio SWT");
shell.setLayout(new FillLayout());
// Create and embed SWT BrowserView widget to display web content.
var view = BrowserView.newInstance(shell, browser);
view.setSize(1280, 800);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
// Shutdown Chromium and release allocated resources.
engine.close();
display.dispose();
}
}
// KotlinSwtApp.kt:
import tech.fuzio.dsl.Engine
import tech.fuzio.engine.RenderingMode.HARDWARE_ACCELERATED
import tech.fuzio.view.swt.BrowserView
import org.eclipse.swt.layout.FillLayout
import org.eclipse.swt.widgets.Display
import org.eclipse.swt.widgets.Shell
fun main() {
// Initialize Chromium.
val engine = Engine(HARDWARE_ACCELERATED)
// Create a Browser instance.
val browser = engine.newBrowser()
// Load the required web page.
browser.navigation().loadUrl("https://html5test.jiku.co")
val display = Display()
val shell = Shell(display)
shell.text = "Fuzio SWT"
shell.layout = FillLayout()
// Create and embed SWT BrowserView widget to display web content.
val view = BrowserView.newInstance(shell, browser)
view.setSize(1280, 800)
shell.pack()
shell.open()
while (!shell.isDisposed) {
if (!display.readAndDispatch()) {
display.sleep()
}
}
// Shutdown Chromium and release allocated resources.
engine.close()
display.dispose()
}
Run the SWT application
Use the following command to build and run SWT application:
./gradlew run -Dfuzio.license.key=<your_license_key>
Once launched, you will see an SWT application with a BrowserView component displaying https://html5test.jiku.co:

What’s next
- Learn more how to add Fuzio to a Gradle project.
- Read about how to embed Fuzio into an SWT app.
- Discover all Fuzio features by checking out our guides.

