13.08.2020 - Ryan Forde
Despite popular belief, Java is far from dead and is actually the second most popular programming language overall, particularly in Enterprise Software.
It still enjoys a very active community, a rich ecosystem of tooling, a ton of libraries and frameworks, it is able to adapt and evolve while being backwards compatible (mostly) and it is still widely used in the industry.
Modern Enterprise Applications
While Java provides a great environment for server-side and native applications, modern enterprise application clients are increasingly moving toward HTML5 standards. This is because they leverage broader compatibility across a wide range of browsers, devices, and environments to satisfy user demand.
WebAssembly and modern browsers change this completely. By allowing to look at the browser as a compilation target, WebAsembly eliminates these tradeoffs.
What is WebAssembly?
WebAssembly, or WASM for short, is a small, fast binary format that promises near-native performance for web applications. It is a standard supported by over 93% of the browser stock (July 2020).
How to convert Java to HTML5
There are currently a few options when it comes to compiling Java to HTML5 :
- JWebAssembly - A Java bytecode to WebAssembly compiler. It can generate the WebAssembly binary or text format. It is written in Java itself and can be integrated with other Java build tools. It has a limited runtime (excluding Swing, AWT) and is good for writing new applications from scratch.
Differently from alternative solutions, CheerpJ does not require any change to be made to the source code of the application, supports 100% of the Java language and runtime, and is not a framework and thus in no way opinionated.
CheerpJ’s primary target is to convert and migrate existing Java client applications to HTML5, including Swing clients, Java Applets, and Java libraries.
Using CheerpJ to convert your Java application is straightforward:
- Convert ahead-of-time all your .jar archives using the CheerpJ compiler;
- Embed your converted application (or link, if a library) in a HTML page, and access it from any browser.
CheerpJ does not require any server-side support, as all application components (converted application and runtime) are static. You can put a CheerpJ application behind a CDN to virtually cancel any bandwidth costs.
CheerpJ is available for Windows, macOS and Linux, and can be downloaded here .