Hands-on with Java and Wasm
WebAssembly, or Wasm, provides a generalized, lightweight native binary format for any language that can be compiled to it. Once the source language is transformed into WebAssembly, that compact binary can run in a variety of contexts, from cloud virtual machines and desktops to IoT and mobile devices. One of the most interesting environments Wasm supports is the web browser. In this article, we’ll look at how to compile your Java code into WebAssembly, then we’ll run a demo application in a web server and see it in action.
Why use WebAssembly for Java?
Wasm provides a way to execute Java on the front end in the web browser, where your Java API can be called from JavaScript. WebAssembly compilers generate a binary from the Java source (or from the bytecode) and that binary is executed by the browser using the host operating system capabilities, so you get OS-level performance. The Java code gets turned into a Wasm binary, which exposes hooks you call from JavaScript.
Author: . [Source Link (*), InfoWorld]