Why Don’t You Use Java for Programming the Client-Side Web Apps on Web Browser?
I would like to know, what are the obstacles for you as Java developers not using Java as programming language for writing Web browser apps. Web browser apps are client-side and not server-side Web apps. For running Web browser apps you mostly don’t need a Web server, you just need HTML, CSS and JavaScript files.

I’m doing Web browser programming using Java with GWT / J2CL and surely it is not perfect because the Web browser APIs feel very JavaScript but I have following advantages:
- We use Java as the language
- We have the best ecosystem like libraries, frameworks, build system and IDEs.
- We know best design patterns to make our apps maintainable like Dependency Injection, Mock Testing and many other just take a look at: http://bit.ly/DesignPatternsJava
- … and if you use Java on the server-side with Spring Framework or JavaEE you have one language through the whole stack. So, you could reuse Validation APIs, Business Rules, Business Model, etc. from server to client.
In the mean time I have written following articles in this domain:
- Web Browser Programming in Java
- Learn Once Use Everywhere: JavaScript in Java for Web Browser
- Using IndexedDB in Web Browser — All in Java with Mrs. Gwitany and Dr. Jackl
- Impressions on Modern Java Web Browser Development with GWT
… and also I created a collection of GWT / J2CL information as Padlet: https://bit.ly/GWTIntroPadlet
I know that for “Hello World” or trivial Web browser apps I don’t need Java with transpiler. In this case I just write a simple JavaScript. But in our daily jobs we don’t write “Hello World” apps and the maintenance of those apps is very important, therefore we use language like Java for its strongly typed and the things I’ve shown you above. This is also the reason why we see TypeScript everywhere today. VueJS 3 is completely written in TypeScript.
Anders Hejlsberg creator of TypeScript said in an interview:
Developers by then had started to build huge JavaScript apps for the browser and were struggling to write them in JavaScript, a language he says lacked key features like modules, classes, and, importantly, a type system for creating order through rules in a program.
The interview was very interesting, definitely a must read: http://bit.ly/AndersHTypeScriptInterview
Also my question goes to the use of TypeScript. You also use a transpiler in TypeScript so actually it is just similar to Java with GWT / J2CL. Why would you use TypeScript as a Java developer?
I know that for JavaScript developers TypeScript is much “nearer” in comparison to Java. Here is the definition of TypeScript:
TypeScript = JavaScript + Static Types + Transpiler + Tooling
But for Java developers? I don’t think that TypeScript has advantages over Java. Therefore my conclusion is:
- If you are coming from Java use Java on Web browser with GWT / J2CL transpiler.
- If you are coming from JavaScript use TypeScript on Web browser.
One last point, maybe a lot of Java developers only work on server-side (backend) and not on client-side (Web browser), so there is no need to write something on Web browser?
Discussion at HackerNews: https://bit.ly/HackerNewsTypeScriptJavaGWT
Thanks a lot for your input!