Wax meets Java.

Build a small warehouse application, drive it from Java, 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.

The generated binding uses Java’s Foreign Function and Memory API and requires Java 22 or newer. Android uses a separate “android” binding target that packages a JNI backed AAR.

Generate the Java binding.

Ask the Wax compiler for a Java 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 Java side.

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

Host/java/src/main/java/WarehouseHost.java

Run it.

Build the Wax project, run the Java 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.