Skip to content

1. Set up the project

fakeivchenko edited this page Oct 10, 2026 · 4 revisions

Before you write any code, check what your platform needs and create a Gradle project that depends on lwjwae.

Before you begin

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-0t64 and libwebkit2gtk-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 the project

  1. 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
    
  2. 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"
  3. 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-UNNAMED to 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

Clone this wiki locally