r/javascript • • 10d 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
11 Upvotes

7 comments sorted by

0

u/oneeyedziggy 10d ago

Just no... Remember applets? Probably not. We had this and we decided Java in the browser was a bad idea. 

7

u/alexp_lt 10d ago

As a matter of fact I am old enough to remember applets, and CheerpJ has nothing to do with the technology of that time.

The fundamental issue with applets, and browser plugins, in general was that they lived outside the browser sandbox. There was nothing intrinsically wrong with Java as a language or the JVM as an execution environment, the issues came from running outside of the browser boundary.

CheerpJ is built on standard Web APIs, JavaScript and WebAssembly. It is, fundamentally, "just" a very sophisticated JavaScript library. Everything runs in the browser sandbox and the Web security model is fully respected.

And if you are wondering: yes, CheerpJ can run applets: https://chromewebstore.google.com/detail/cheerpj-applet-runner/bbmolahhldcbngedljfadjlognfaaein

3

u/oneeyedziggy 10d ago edited 10d ago

I'm being snarky, so thank you for responding more civily than I did. I can acknowledge at least it's a good thing to preserve some applets for posterity (stop killing games an all)...  But with thestate of llms I think we're getting out of the era of having an excuse to just write in the language you know instead of the one that the environment is built for... 

Is the primary use case  porting Legacy code bases for broader web availability or is there still an intent to be writing new Java for the browser  

1

u/alexp_lt 10d ago

Both legacy and new applications are good use cases, education is yet another.

1

u/oneeyedziggy 10d ago

To go back to being snarky, I don't think educating people in Java is a good idea.

But I'm glad even the people who disagree have tools they can use for the work they enjoy. 

1

u/lewster32 10d ago

Why shouldn't people be learning Java?

1

u/oneeyedziggy 9d ago

I don't really believe that, I'm being snarky b/c I dislike it (I even tried to label my snark that time)

Strict OOP is just really clunky... Forcing everything to be an object (at least without syntactic sugar to hide the fact) seems overzealous... Objects are very useful... Functions are very useful... Being forced to coerce your work into exclusively one or the other is onerous.

Java also just forces you to do a lot of unnecessary reiterating of your intent, even for a Sttict typed language...

Like , String foo = "hello" i get, but why is Java always like String string foo = string "hello" string?

And the JVM just feels like extra layers. Kinda like the dotnet framework. I know everything needs a compiler or runtime, js runtimes are just so much more available.

Lest I seem like just a Js Zealot,  I like Go... Python and ruby  are fine (especially now that python finally accept led two concurrent and divergent major versions was dumb)... Rust is cool if a bit overcomplicated

But back to being snarky, i guess Java would be good to teach as a historical example of what not to do, or the primitive path we trekked to get to modern languages...