Java: Winning Many Battles, Now To Win The WarJava is winning many battles these days with 6 month release cycles, exciting new features, and more. However, there is a bigger war looming: the war for the browser. This is a war Java can't afford to lose. Read on for a winning strategy and what you can do to help.
A Bit Of HistoryIn the late 90's and 2000's, Java had a strong presence in the browser. Java Applets were Java UIs that ran directly on a web page — think Canvas but with Java APIs for drawing and sound. Java Web Start let you launch full Java UIs from the browser. Both of these could communicate with services running on Java App Servers, for a full-stack Java experience. Indeed, the initial excitement over client-side Java led people to try it out server-side, where it became even more popular. Remember this for later: client-side dominance has a history of extending server-side.
Yes, you can still make websites using Java technology. There are plenty of 'official' technologies like JSP and JSF. Unfortunately, these technologies are entirely server-side. You can generate the page using Java libraries and business logic, but once it is sent to the browser it is static and lifeless. User interaction requires one of two ugly options:
- A round-trip back to the server (slow — a bad user experience)
Improvements are now coming every 6 months, thanks to the new release cadence. Already new garbage collectors, easier to use strings, and improved threading are available either for production or for evaluation. However, when you think about which of these innovations are for building browser-based apps, you quickly realize that Java client-side innovation has all but stopped, at least via the official channels.
As the famous saying goes, we don't want to win the battle but lose the war. How can Java increase its relevance? How can Java win back client-side developers? How can Java prevent other technologies from leveraging front-end dominance to win the back-end, like Java once did to other technologies?
How To Win The WarTo win the war, Java needs a strong client-side option. One that lets developers make modern web applications using Java code. One that leverages web technologies. One that supports components. One that builds quickly. One that produces fast-downloading, high performance, 100-Lighthouse-scoring apps. One that plays nicely with other JVM languages. What does Java need?
- Numerous Web APIs ready for use via type-safe Java wrappers.
- A rich component framework to build apps from reusable components
- Numerous pre-built components
- Single-page app support with a shadow DOM and routing
- Easy, transparent calls to web services
- Graphical apps that draw their entire UI on a Canvas and have very little HTML or CSS. These apps may just need TeaVM.
- Single-page web apps that use HTML and CSS. These apps benefit from using the Flavour framework on top of TeaVM to handle routing, invoking REST services, and JSON parsing.
- A primarily Canvas-based app that uses Flavour to occasionally show other HTML pages.
- A primarily HTML-based app that includes a Canvas on certain pages.
How To Move ForwardTeaVM is ready for use in your projects. It is stable, documented, and has example code on the TeaVM site, as well as elsewhere.
Most of all, TeaVM needs your endorsement and promotion. Instead of discussing and advocating legacy Java web technologies, help ensure Java has another 25 years of success — please promote and use TeaVM!
How to help?
- Build your first TeaVM project. It takes just 2 commands.
- Read the forums where developers discuss TeaVM and Flavour