Recently, I discovered a Java compiler for web applications that I’d like to share with you. It’s called CheerpJ, and it has the ability to convert any Java application and library into a browser-based web application.
CheerpJ is developed by the creators of Cheerp, a C++-to-JS compiler that produces fully garbage-collectible and optimized JavaScript output. Using Cheerp and other tools has made compiling C/C++ to the browser much easier.
When it comes to CheerpJ, it compiles Java bytecode into JS with 100% Java compatibility, including support for dynamic class loading and reflection.
You can use CheerpJ on an entire Java archive or individual class files to generate a .jar.js or .js output. It leverages the original .jar metadata for reflection.
After CheerpJ completes the conversion, you can remove all the bytecodes before web deployment. CheerpJ also offers a simple tool for this purpose and assists in reducing download time. Often, the resulting JS is comparable to the original Java code.
Additionally, CheerpJ provides different filesystem access methods, including read-only and HTTP-based filesystem options.
The creators of CheerpJ have provided demos to showcase its capabilities, which you can view here.
A limited release of CheerpJ will take place in July, with the full commercial version becoming available later this year. As a bonus, a Chrome extension called CheerpJ Applet Runner has also been released.
Image Source: Freedomz / Shutterstock