展示 HN:Webassembly4J 从 Java 运行 WebAssembly

2作者: tegmentum6 天前原帖
我发布了 WebAssembly4J,并附带了两个运行时绑定: - Wasmtime4J – Wasmtime 的 Java 绑定 [链接](http://github.com/tegmentum/wasmtime4j) - WAMR4J – WebAssembly Micro Runtime 的 Java 绑定 [链接](http://github.com/tegmentum/wasmr4j) WebAssembly4J 是一个统一的 Java API,允许在不同的引擎上运行 WebAssembly [链接](http://github.com/tegmentum/webassembly4j)。 这个项目的动机在于,当前 Java 有多个新兴的 WebAssembly 运行时,但每个运行时都暴露了自己的 API。如果你想尝试不同的引擎,就必须每次都重写集成层。 WebAssembly4J 提供了一个单一的 API,同时允许在底层使用不同的运行时提供者。 项目目标: - 从 Java 应用程序运行 WebAssembly - 允许跨引擎比较运行时 - 使 WebAssembly 运行时对 Java 开发者更易获取 - 在运行时演变的同时提供稳定的接口 当前支持的引擎: - Wasmtime - WAMR - Chicory - GraalWasm 为了支持传统和现代的 Java 环境,该项目的目标是: - Java 8(JNI 绑定) - Java 11 - Java 22+(支持 Panama) 构件已发布到 Maven Central,因此可以直接添加到现有项目中。 我非常希望听到从事 Java + WebAssembly 集成或运行时实现的人的反馈。
查看原文
I’ve released WebAssembly4J, along with two runtime bindings:<p>Wasmtime4J – Java bindings for Wasmtime <a href="http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;wasmtime4j" rel="nofollow">http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;wasmtime4j</a> WAMR4J – Java bindings for WebAssembly Micro Runtime <a href="http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;wasmr4j" rel="nofollow">http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;wasmr4j</a><p>WebAssembly4J – a unified Java API that allows running WebAssembly across different engines <a href="http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;webassembly4j" rel="nofollow">http:&#x2F;&#x2F;github.com&#x2F;tegmentum&#x2F;webassembly4j</a><p>The motivation was that Java currently has multiple emerging WebAssembly runtimes, but each exposes its own API. If you want to experiment with different engines, you have to rewrite the integration layer each time.<p>WebAssembly4J provides a single API while allowing different runtime providers underneath.<p>Goals of the project: Run WebAssembly from Java applications Allow cross-engine comparison of runtimes Make WebAssembly runtimes more accessible to Java developers Provide a stable interface while runtimes evolve<p>Currently supported engines: Wasmtime WAMR Chicory GraalWasm<p>To support both legacy and modern Java environments the project targets: Java 8 (JNI bindings) Java 11 Java 22+ (Panama support)<p>Artifacts are published to Maven Central so they can be added directly to existing projects.<p>I’d be very interested in feedback from people working on Java + WebAssembly integrations or runtime implementations.