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:

  1. We use Java as the language

In the mean time I have written following articles in this domain:

… 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.

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?

Thanks a lot for your input!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store