Skip to content

Latest commit

 

History

History

graalwasm-starter

GraalWasm Quick Start

A minimal Java application that embeds a WebAssembly module with GraalWasm.

Preparation

Install GraalVM for JDK 23 and set the value of JAVA_HOME accordingly. We recommend using SDKMAN!. (For other download options, see GraalVM Downloads.)

sdk install java 23-graal

Run the Application Using Maven

To build and test the demo, run:

./mvnw test

To execute the main method, run:

./mvnw exec:java

Run the Application Using Gradle

To build and test the demo, run:

./gradlew test

To execute the main method, run:

./gradlew run

Implementation Details

The WebAssembly is stored in the resource file add-two.wasm. You can examine its textual representation in the resource file add-two.wat. If you want to experiment with and tweak the WebAssembly module, you will need to rebuild the add-two.wasm file from the add-two.wat file. For that, you can use the wat2wasm tool from the wabt toolkit. You can also use this web app to run wat2wasm in your browser instead of installing wabt.