The task would involve compiling three big and complex C++ libraries (that have no equivalent in other languages) to the respective bytecode formats, and my past experiments (from the time before Emscripten was a thing) were not very successful. Maybe that has improved in the meantime, maybe not.
Nothing beats clang's wasm output in that regard (e.g. both Emscripten's 'emcc' and Zig's 'zig cc' are drop-in replacements for a GCC-like toolchain which can produce WASM).
But AFAIK that's only supported by the MSVC toolchain which in turn only runs on Windows (and I tried too often running MSVC on non-Windows operating systems via Wine, even if it works, the process there it's a mess).
JVM has it's own object model (which doesn't even have value type support when defining memory layouts), GC, etc. Bad level of abstraction for low level language target (although it has been tried many times).
Not to mention runtime is anything but lightweight and easily embeddable.
"NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes."
I mean, you just create an array of longs and that’s it? That’s pretty much what wasm does as well.
> Not to mention runtime is anything but lightweight and easily embeddable
There are more JVM implementations than Wasm ones, I’m sure there are plenty small, embeddable one. But arguably the best would have been a single, performant JVM built into the browser instead of the JS engine, allowing for both scripted usage and this “sandboxed compile target” one. (Applets failed more due to politics, than anything)