CheerpJ Revitalizes Legacy Java Applications |
Written by Nikos Vaggalis | |||
Thursday, 20 February 2020 | |||
CheerpJ is a Java-to-Javascript runtime and compiler that can convert any Java application to HTML5 for in-browser rendering. CheerpJ 2.0, which features WebAssembly support, was released earlier this month.
According to its developers, Leaning Technologies, a company which provides WebAssembly solutions, its use-case scenarios are threefold :
There is another advantage that I would add to that list of scenarios. As browsers have disabled the Java plugin, essentially killing the running of Java applications in the form of Applets within the browser's sandbox, Enterprises that run mission-critical Applet applications were left in despair with not many options left; running outdated browsers and unpatched Java versions versions which would increase many times over the risk of becoming hacked or exploited. With CheerpJ, at the same time as avoiding being hacked you can also modernize these applications.
The runtime also supports file system access, audio via WebAudio, printing via the browser printing dialogue and HTML5 WebWorkers. After converting the Java application to Javascript through the compiler you can host it in HTML by linking to the CheerpJ runtime, loader.js, from its cdn:
This page will initialize the CheerpJ system, create a graphical environment to contain all Java windows and then execute the main method of AppClass. The second parameter of cheerpjRunMain is a separated list of JARs where application classes can be found (the classpath).That is because the original jar files are required to be deployed alongside the application to support reflection and dynamic class generation, although just the archive structure and metadata are preserved, nothing else.This simple HTML page can now be served on a http server. CheerpJ's vesion 2.0 introduces extra WebAssembly runtime modules, which are used when computationally heavy operations are required. Although CheerpJ has a web page on Github, it is closed source and the repo is used only for hosting instructions to get you started. CheerpJ is free to use for non-commercial purposes, as well as for technical evaluation; any other use will require a license. Still if you think that you fit its target group you can check that it works before going for a license as it is freely available for downloading. Finally, there is an online playground, where you can write Java code and see it rendered in real time with CheerpJ, as well as the CheerpJ Applet Runner Chrome plugin with which you can run legacy Java Applets on Chrome without having to install Java. More InformationRelated ArticlesPython & WebAssembly Plus Science Equals Pyodide
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
|
|||
Last Updated ( Thursday, 20 February 2020 ) |