Wax meets Kotlin.

Build a small warehouse application, drive it from Kotlin, and save a recording of the result.

The Wax side of this example is on the Embedding Wax overview. Read it first to understand Wax's three communication paths and their recording behaviour.

Download the complete example (.tar.gz). Extract it and open a terminal in the extracted directory. It includes the Wax source, manifest, host source, and host build files used below.

Install Wax and add its tools to your PATH. You also need: JDK 22 or newer and Gradle 9. Run Gradle with JAVA_HOME pointing to that JDK.

Kotlin/JVM uses Wax’s generated Java binding through standard Java interop. Android needs a separate “android” binding target that packages a JNI backed AAR; Kotlin/Native is not yet supported.

Generate the Kotlin binding.

Ask the Wax compiler for a Kotlin binding, then build the project. The generated code contains the typed host functions, channels, and APIs declared in the Wax source on the embedding overview.

wax.json
wax build

The Kotlin side.

The host connects the services Wax needs, stages channel data, runs frames, calls Wax APIs, and writes the recording.

Host/kotlin/src/main/kotlin/Main.kt

Run it.

Build the Wax project, run the Kotlin host, then open the resulting warehouse.wxs recording in the debugger.

warehouse




Host guides.

Choose a host language to wire this Wax interface into an application.