CheerpJ 3.0 - Run Java Apps Inside The Browser |
Written by Nikos Vaggalis | |||
Thursday, 08 February 2024 | |||
CheerpJ is a Java-to-Javascript runtime and compiler that can convert any Java application to HTML5 for in-browser rendering. Version 3.0 has been fully rewritten from scratch. Wouldn't be awesome to be able to run Swing, legacy Java GUI apps, or Applets inside the browser? CheerpJ's, according to its developers Leaning Technologies, use-case scenarios are threefold :
If you thought that legacy apps are not used anymore in this day and age, think again. A huge market lies behind corporations still , say, on Oracle Forms with Java 8 and Applets which in order to run need a special ESR Firefox browser that still supports the java plugin. Many Enterprises are using such legacy stacks and still talk Java. For instance the majority of Fortune 500 list of companies do, and the reasons for that are plenty. The most important, and the one that enterprises value most, is backwards compatibility, since they are notoriously allergic to radical updates and upgrades. Systems that worked 20 years ago, written in Java 5, should be able to compile and run under version 8. Stability is what matters. So being able to port such apps to modern times and run them inside any browser with no changes in the underlying infrastructure, is something which is in great demand. As such CheerpJ's main target group is real-world Enterprise applications. To support such a crucial endeavor, CheerpJ comes with a set of other features:
And of course interoperability with JavaScript: Library mode As a practical example, these few lines of code make it possible to generate a PDF from JavaScript using the popular iText library: JavaScript natives Of course if you want to port a C/C++ application to the web, there's also Cheerp C++ that lets you compile virtually any C/C++ code to WebAssembly and JavaScript. While primarily used to port existing C/C++ libraries and applications to HTML5, it can also be used to write high-performance Web applications and WebAssembly components from scratch. Using Cheerp, C/C++ code gets compiled into JavaScript/WebAssembly as well as becoming optimised with the right JavaScript interfaces being exposed, and can be easily integrated in a web application. The C++ version unlike the Java one, is also open source as we examined in Cheerp C++ To Webassembly Compiler Now Open Source. Still despite CheerpJ being closed source, it however is free for personal use. At this point it is also important to note that a current limitation of CheerpJ is that it runs only on Java 8, which might be sufficient for running legacy applet based applications but is not cut for the modern stack. However on the project's roadmap is to support multiple Java versions as well as multiple runtime environments. The Cheerp family of runtimes comes as an addition to other ways of running WebAssembly applications nowadays. Another alternative which we've recently covered in Wasmer JS SDK - WebAssembly In The Browser is through WASI(X) or Wasmer: WASIX is an extension to the WebAssembly System Interface (WASI) designed to make WebAssembly (Wasm) more compatible with POSIX programs, enabling the seamless execution of more complex applications in both the browser and server environments. To experience yourself what WebAssembly is capable of doing, check this example of Browsercraft which is a proof-of-concept demo of Minecraft 1. 2. 5 running unmodified in the browser, powered by CheerpJ. There is also 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 Information
Related ArticlesWasmer JS SDK - WebAssembly In The Browser Cheerp C++ To Webassembly Compiler Now Open Source Running PostgreSQL Inside Your Browser
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.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Monday, 11 November 2024 ) |