This is a simple example for using the java-sdk of the extism web-assembly plugin system with a JVM application.
The extism library uses a native library written in rust to load and execute web-assembly code.
Therefore it is required to install the extism
library in the library path, see https://extism.org/docs/install.
Alternatively the path to the extism
library can also be specified via the system property -Djna.library.path=/path/to/exitsm/lib
mvn verify
via exec-maven-plugin
:
mvn compile exec:java -Dexec.mainClass="example.ExtismExample"
or plain java launcher:
$ java -cp target/extism-java-*-with-dependencies.jar example.ExtismExample "src/main/resources/code.wasm" count_vowels "Hello World"
Example output:
Executing "count_vowels" from "src/main/resources/code.wasm" with input "Hello World"
{"count": 3}