Live data from Hacker News

CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

leaningtech.com

101–110 of 179 posts

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#102

With this and Ruffle, we will soon return to the days of Internet Explorer 6 but with 4k monitors! All we need now is to run ActiveX. I think BottledWine can run Windows executables in the browser, how hard would it be to simulate the ActiveX bindings?

anyone remember dhtml, which allowed adding powerpoint-like transitions to hyperlinks?

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#103
post #77

If only we could get a new version of Java for the browser. Something more of a scripting language that is not compiled but interpreted. Could probably knock out a proof of concept in a week, might call it Javascript or something... In all seriousness, anything that spits out canvas for a simple textbox is completely misguided about what the web is.

> In all seriousness, anything that spits out canvas for a simple textbox is completely misguided about what the web is. I suspect the goal is a way to bring Java desktop applications into the browser without rewriting the application from scratch. Personally, as a fan of Blazor, I thought this was going to be a Java-based analog of Blazor; or a modernized replacement for GWT. (One flavor of Blazor compiles C# to WAS…

Agreed that many people will want to build true web single-page apps, not port Swing to the web in a Canvas.

A Java option for modern web apps exists, and it's called Flavour: https://flavour.sourceforge.io/

* Build SPAs in Java with HTML templates and components

* Fast build times and batteries-included build framework

* Easy calls to Java web services, just invoke a method and Flavour handles marshalling and unmarshalling, you just see/use Java objects.

* Full-stack refactoring

* Built on TeaVM, so you get the all the benefits of a mature, performant framework with support for threads and multiple JVM languages (bytecode-based transpilation).

TeaVM vs Blazor comparison chart: https://frequal.com/java/TeaVmVsBlazorChart.html

TeaVM longer comparison with Blazor: https://frequal.com/java/TeaVmVsBlazorWasm1-0.html

Java Magazine article on Flavour and TeaVM: https://blogs.oracle.com/javamagazine/post/java-in-the-brows...

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#104
post #13

This is pretty awesome technically. Java everywhere without a JVM install. What's its footprint?

A while back CheerpJ had a huge footprint and terrible startup time compared to TeaVM: https://renato.athaydes.com/posts/comparing-jvm-alternatives...

TeaVM has become even smaller and faster since that article was published. The test suites are here in case someone wants to conduct a rematch: https://github.com/renatoathaydes/jvm-alternatives-to-js

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#105
post #47

Earlier quoted context omitted.

Probably depends on what you are optimizing for. If this metric is an app startup time then AOT is super beneficial and always beats JIT without strings attached.

Well yeah, but that’s hardly a metric for performance.

Why is this being downvoted? I find it pretty clear that there is a trade off between startup time and performance. You can also observe this sort of behavior by tweaking -XX:TieredStopAtLevel when launching Java. You get marginally faster startup times but at the cost of run-time performance. And anecdotally I've seen native images start up faster but also have marginally slower runtime performance than launching a JVM and letting C2 do its thing.

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#107
post #77

Earlier quoted context omitted.

> In all seriousness, anything that spits out canvas for a simple textbox is completely misguided about what the web is. I suspect the goal is a way to bring Java desktop applications into the browser without rewriting the application from scratch. Personally, as a fan of Blazor, I thought this was going to be a Java-based analog of Blazor; or a modernized replacement for GWT. (One flavor of Blazor compiles C# to WAS…

Agreed that many people will want to build true web single-page apps, not port Swing to the web in a Canvas. A Java option for modern web apps exists, and it's called Flavour: https://flavour.sourceforge.io/ * Build SPAs in Java with HTML templates and components * Fast build times and batteries-included build framework * Easy calls to Java web services, just invoke a method and Flavour handles marshalling and unmars…

> TeaVM vs Blazor comparison chart

Blazor has the full task API. Asynchronous tasks run just like Javascript promises.

Does TeaVM have true threading, or is it emulating threads via some higher-level concept? (IE, if I have a multicore CPU, will TeaVM take advantage of multiple cores?)

Unless you're trying to do true CPU-intense parallel computing inside the browser, where you need the power of real CPU-level concurrency, "real threads" in the browser has no gain over the task API.

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#108
post #72

Related, if you like Java but want to create a modern, Lighthouse-ready web app, check out Flavour: https://flavour.sourceforge.io/

What is Lighthouse in this context?

The Lighthouse test tool in Chrome, commonly used to test real-world application performance.

TeaVM apps score quite well on Lighthouse. Previous iterations of CheerpJ had challenges in startup time and download size. Results here: https://renato.athaydes.com/posts/comparing-jvm-alternatives...

For a concrete test, try launching this full TeaVM/Flavour 5-letter word game, it downloads in https://frequal.com/wordii/

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#109
post #73

For anyone interested in the Kotlin side of things: Kotlin has a great compat with Kotlin/JS[0]. they also have Compose For Web which is more WASM based[1] though its marked as experimental [0]: https://kotlinlang.org/docs/js-overview.html [1]: https://github.com/Kotlin/kotlin-wasm-examples/tree/main/com...

Have you used them in production and would you recommend it?

The company I work for was a very early adopter of kotlin/js. During the pandemic we published an open source contact tracing web platform aimed at universities. https://github.com/studoverse/campus-qr The stack is actually great to work with. Having every property in React typed is nice and sharing classes between front and backend ensures you can't accidentally send the wrong fields or types.

Re: CheerpJ 3.0: a JVM replacement in HTML5 and WASM to run Java on modern browsers

#110

With this and Ruffle, we will soon return to the days of Internet Explorer 6 but with 4k monitors! All we need now is to run ActiveX. I think BottledWine can run Windows executables in the browser, how hard would it be to simulate the ActiveX bindings?

anyone remember dhtml, which allowed adding powerpoint-like transitions to hyperlinks?

DHTML was basically just a buzzword for the first SPA interactions.

The first, real uses cases for XMLHttpRequests was sending chunks of HTML over the wire and updating the DOM via JavaScript - so “Dynamic HTML”

Post reply on HN