I Put a Full JVM Inside a Browser Tab

27 points by juliethefoxcoon


carlana

Time is a flat circle.

jrwren

Applets without the browser plugin? neato.

yuri91

This is a cool experiment and a nice learning experience. I don't like to shill on someone else's post, but:

We’re exploring using JavaBox for a Java documentation site. The idea is that when you’re> reading about, say, HashMap or generics or whatever Java concept, there would be a “Try It” button right there on the page. Click it. Edit the example code. Hit run. See the output. No installing a JDK. No setting up an IDE. No server processing your code somewhere.

And

The other idea is shareable snippets. You write some Java, get a URL, send it to someone. They open it and the code runs in their browser. No backend to maintain. No server costs that scale with users. Every user’s browser is doing its own compute. It’s serverless in the most literal and also most ridiculous sense of the word.

You can do these today with CheerpJ

See this sharable snippet with a Swing application for example

Disclaimer: I work on CheerpJ

kana

Oracle GraalVM 25 supports a --tool:svm-wasm option to compile things into WASM, and they currently have a javac on WebAssembly demo (which downloads a 30 MB WASM blob). I wonder if one can also compile TeaVM or Espresso to WASM for a Java playground, which hopefully should be faster than a JVM over QEMU over WASM. But regardless, it's quite crazy what container2wasm can do these days, as is demonstated in the post.

Edit: Just found TeaVM's playground allowing you to compile Java code and run them in the browser.