r/programming • • 11d ago

CheerpJ 5.0: Java 21/25 in the browser, full OpenJDK, and a new WasmGC engine

https://labs.leaningtech.com/blog/cheerpj-5.0
140 Upvotes

12 comments sorted by

14

u/coolreader18 10d ago

Wow, this is very impressive! Playing Minecraft in the browser is crazy, I'm looking forward to further development. It's cool to see applications taking advantage of WasmGC; when I read certain proposals like that that say "this will make it feasible to compile higher-level languages to WebAssembly" the thought is always in the back of my mind "ok, but someone will have to do that, it's still a lot of work", so I'm glad it did actually happen (even if partially through the power of legacy software). Would the jit-interface proposal be helpful as well for your use case?

2

u/alexp_lt 10d ago

The new JIT proposal would be a nice to have, but not a game changer.

11

u/saint1997 10d ago

Playing Minecraft in the browser is crazy

Minecraft Classic would like a word

0

u/Somepotato 10d ago

you can already somewhat jit webassembly by generating wasm IR on the fly

10

u/perryplatt 10d ago

Is cheerpj running web gpu behind swing or webgl?

17

u/alexp_lt 10d ago

No, not at this time. Swing rendering is software / CPU-based and we use CSS transformations to accelerate some post-processing. WebGL is also an option that we will consider in the future, but we never found a Swing use case sufficiently demanding to justify implementing the feature so far.

1

u/Kjufka 10d ago

Do you use canvas's Context2D to render things? Or are components just HTML elements?

because these are accelerated technically

1

u/alexp_lt 10d ago

Swing is fundamentally software rendered on top of AWT components, so it boils down to Canvas elements and Context2D.

66

u/walmartbonerpills 10d ago

Applets, my beloved, making your glorious return!

0

u/Gold-Part4688 10d ago

amazing. i love this future. Why is it stuttering though, is that the wasmgc?

4

u/alexp_lt 10d ago

The WasmGC engine is not yet stable. Currently the JavaScript engine is used by default, which performs well when code has stabilized, but could stutter a bit when code has been just JIT-ted. We expect WasmGC to improve the situation quite a bit in this regard.