Compile Java to WebAssembly & JavaScript

CheerpJ 2.1 adds more features for bringing Java bytecode to the web

Maika Möbus
CheerpJ 2.1
© Shutterstock / Johan Swanepoel

CheerpJ 2.1 has arrived with several updates on board for bringing Java to the web. CheerpJ is a tool that comes with a full Java 8 SE runtime environment. It is designed to compile Java bytecode into JavaScript and, since version 2.0, which was released two months ago, also to WebAssembly. Let’s take a look at the latest maintenance release.

The company Leaning Technologies has released CheerpJ 2.1, as announced in a Medium blog post.

CheerpJ is designed to convert legacy Java applications into JavaScript and WebAssembly, thus bringing Java to the web. For this, it has an AOT compiler, a Java runtime in WebAssembly and JS, and an interoperability API on board.

SEE ALSO: Scala.js version 1.0.0 released: Compile Scala to JavaScript code

Let’s dive right in and see what’s new in CheerpJ 2.1.

Features in v2.1

CheerpJ 2.1 is a maintenance release which adds bug fixes and updates several features.

For example, v2.1 includes an updated Java exception handling: Java exceptions should now be compiled to more efficient JavaScript code. The handling of native Java reflection calls has been updated as well, and the build size of CheerpJ’s ahead-of-time JavaScript output has been reduced.

CheerpJ can now also create stub JavaScript files for native methods, allowing for custom browser-based implementations of native methods in JavaScript and WebAssembly.

Other updates introduced in v2.1 are designed to improve the robustness of the AOT compiler and JavaScript interoperability.

SEE ALSO: JavaScript on top, Python ties with Java in RedMonk rankings

CheerpJ can be used on Windows, macOS or Linux and is available as Community, Essential or Enterprise edition. As the website states, “CheerpJ is free to use for non-commercial purposes, as well as for technical evaluation. Any other use will require a license.”

The CheerpJ GitHub repository can help you get started.

See more in the blog post.

Maika Möbus
Maika Möbus has been an editor for Software & Support Media since January 2019. She studied Sociology at Goethe University Frankfurt and Johannes Gutenberg University Mainz.

Inline Feedbacks
View all comments