Menu

Running Java 21 and Java 25 in the browser via WebAssembly
📰

Running Java 21 and Java 25 in the browser via WebAssembly

DEV Community: java·Liam·15 days ago
#789Lufip
#devtojava#devto#dev#java#await
Reading 0:00
15s threshold

CheerpJ 5 adds Java 21 and Java 25, and ships the full JDK, including javac . Here's how to use both.

Running a JAR on Java 25

<!doctype html> <html lang= "en" > <head> <meta charset= "utf-8" /> <script src= "https://cjrtnc.leaningtech.com/5.0/loader.js" ></script> </head> <body> <script type= "module" > await cheerpjInit ({ version : 25 }); cheerpjCreateDisplay ( 800 , 600 ); await cheerpjRunJar ( " /app/my_application.jar " ); </script> </body> </html>

Enter fullscreen mode

Exit fullscreen mode

version defaults to 8. The supported values are 8, 11, 17, 21 and 25. /app/ is your web server's root, so serve the folder over HTTP ( npx http-server -p 8080 ).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.