英文:
Can the JRE be compiled to and run in Web Assembly?
问题
能够将Java运行时编译成Web版本,只要能够将Java字节码翻译成WebAssembly,并在浏览器中运行Java虚拟机,而不是在广泛不支持的小程序中运行?我知道有一种比这更简单更快的替代方法(JWebAssembly),但这更多地涉及原则而非应用。我只是好奇这是否可能发生。
英文:
Could the Java Runtime be compiled for the Web, given the ability to translate Java bytecode to WebAssembly, and run Java VM from the browser, not in an widely unsupported applet? I know there is a alternative that is both easier and faster than this (JWebAssembly), but this is more about the principle than the application. I am just curious if this could happen.
答案1
得分: 3
这个问题与如何在浏览器中使用WebAssembly运行C#存在一些显著的相似之处。Java和C#都在各自的虚拟机中运行,分别是JRE和.Net CLR。
为了在WebAssembly中运行C#,Blazor项目使用了一个开源的CLR实现,并将其编译为WebAssembly。这使得C# DLL能够在浏览器中运行。
完全相同的解决方案也可以用于在浏览器中运行Java,然而,关键可能在于找到一个适用的开源JRE实现,可以将其编译为WebAssembly。
英文:
This question has some significant parallels with how you can run C# within the browser using WebAssembly. Both Java & C# run within their own virtual machine, the JRE and .Net CLR respectively.
In order to run C# within WebAssembly, the Blazor project took one of the open source CLR implementations and compiled it to WebAssembly. This allows C# DLLs to run within the browser.
Exactly the same solution could be used to run Java in the browser, however, a key to this would most likely be finding a suitable open source JRE implementation that can be compiled to WebAssembly.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论