CheerpJ converts Java apps into JavaScript for the web

Applications and Java libraries are converted to web applications, so there is no need for plug-ins or Java installations

Melding Java and web development, CheerpJ is being readied as compiler technology that takes Java bytecode and turns it into JavaScript, for execution in browsers. Based on the LLVM/Clang compiler platform as well as Learning Technologies’ own Cheerp C++-to-JavaScript compiler, CheerpJ takes Java bytecode and turns it into JavaScript without needing the Java source.

In CheerpJ, applications and Java libraries are converted to web applications, so there is no need for plug-ins or Java installations. Server-side Java components can become client-side browser-based libraries while native Java code serves as platform-independent components for the Node.js server-side JavaScript platform.

CheerpJ features an offline compiler moving Java bytecode to JavaScript as well as a JavaScript-based Java runtime environment. Also part of the platform is an on-the-fly compiler for dynamic class generation for deployment alongside the application.

Bidirectional interoperability between Java and JavaScript enables invoking of any JavaScript library or browser API from Java. Also, any Java method can be exposed to JavaScript. CheerpJ can be invoked on Java archive (.jar) files as well as on single .class files. Converted applications that can be deployed on a web server via both jar.js JavaScript files and .jar files.

Learning Technologies said CheerpJ differs from other technologies to put Java in browsers, such as GWT (Google Web Toolkit) in that other technologies lack full support for Java constructions and have only a partial implementation of the Java runtime library. Those limitations make those other technologies better suited for new applications rather than converting existing ones.

Other technologies that compile to JavaScript from other languages include Scala.js, the Kotlin language, and Microsoft’s TypeScript.

A restricted public release of CheerpJ is planned for July, with general availability, including a commercial version, expected by fall. On the horizon as a target for CheerpJ is WebAssembly, a highly touted binary format that could boost web performance and enable other languages to run in browsers.

Also being released is the CheerpL Applet Viewer Extension, a Chrome extension that enables Java applets without requiring a Java installation or plugin. Applets are enabled through on-the-fly compilation by CheerpJ.js. The extension is now in a beta release.

Copyright © 2017 IDG Communications, Inc.

How to choose a low-code development platform