Java started as "applets" in web browser, a while ago...
Was too slow and complicated to be useful, but justified introduction of JavaScript as a "glue" language.
It tool "only" 30 years for Java to come back to web browser :)
And could bet it is still slower than JavaScript :)
CheerpJ 4.3 - Run unmodified Java applications in the browser
CheerpJ is a full WebAssembly-based JVM for the browser, and comes with a complete OpenJDK runtime, as well as a powerful emulation layer to provide file system access, general networking support and other OS-level features. It works fully client-side, via WebAssembly, JavaScript and HTML5 technologies, with no native Java installation required. CheerpJ not only allows you to run existing Java applications in modern browsers, but also makes the browser a viable target for modern Java development.