Repository navigation
1. Set up the project
Before you write any code, check what your platform needs and create a Gradle project that depends on lwjwae.
Make sure that you have the following:
-
Java 25 or later.
-
Gradle 9 or later. The examples use the Kotlin DSL.
-
A web engine for your platform:
Platform What you need Linux GTK 3 and WebKitGTK 4.1. On Ubuntu and Debian, install libgtk-3-0t64andlibwebkit2gtk-4.1-0.Windows Windows 10 or 11 with the WebView2 runtime. Windows 11 includes it, and Microsoft Edge installs it on Windows 10. macOS Nothing else. AppKit and WebKit are part of the system.
-
Create a directory for the project with the following layout:
notes/ ├── settings.gradle.kts ├── build.gradle.kts └── src/main/ ├── java/com/example/notes/Main.java └── resources/app/ ├── index.html └── style.css -
In
settings.gradle.kts, add the lwjwae repository, where the Gradle plugin and the library are published, and name the project:pluginManagement { repositories { maven("https://repo.ivchenko.dev/releases") gradlePluginPortal() } } dependencyResolutionManagement { repositories { mavenCentral() maven("https://repo.ivchenko.dev/releases") } } rootProject.name = "notes" -
In
build.gradle.kts, apply the lwjwae Gradle plugin and name the main class:plugins { application id("dev.ivchenko.lwjwae").version("0.3.1") } java { toolchain { languageVersion = JavaLanguageVersion.of(25) } } application { mainClass = "com.example.notes.Main" }The plugin adds
lwjwae-core, the API that your code uses, and at runtime the backend of the operating system that runs the build. It also passes--enable-native-access=ALL-UNNAMEDto the JVM: lwjwae calls native code through the Foreign Function and Memory API, and the flag lets it do that without a warning. Later in the tutorial, the same plugin builds the native executable and the packages.To declare the modules yourself instead, see Use lwjwae without the plugin.
Previous: Home · Next: Open a window
Tutorial
- Set up the project
- Open a window
- Call Java from the page
- Send events from Java to the page
- Draw your own title bar
- Export notes through a native dialog
- Keep the application in the tray
- Show notifications
- Give the application an icon and a name
- Build a native executable
- Package the application
Guides
- Pass objects through the bridge
- Stream bytes between the page and Java
- Open several windows
- Place and control a window
- Make a transparent window
- Add menus
- Register global shortcuts
- Show progress in the taskbar
- Use the clipboard
- Handle dropped files
- Zoom the page
- Set the window icon
- Follow the theme of the desktop
- Use cookies
- Store data in SQLite
- Keep secrets
- Show dialogs
- Run a single instance
- Open your own links and files
- Update the application
- Handle page permissions
- Handle links and page loads
Reference