back
▲ 1 points

Ask HN: TeaVM or GWT?

by theanonymousone·2y ago·6 comments·view on hn ↗
Well not much beyond the title. For someone who wants to write a client-side web application in Java for whatever reason, which option is better in 2023? Better means more modern and more maintainable in the future (e.g. support latest Java versions). Thanks
6 comments
As an author TeaVM I can tell you about advantages of TeaVM compared to GWT.

1. TeaVM can compile not only Java, but Scala and Kotlin. Actually, any JVM language, which is not using much reflection, invokedynamics and dynamic class loading in its runtime. It's possible because TeaVM uses JVM bytecode, not Java source code, as an input. 2. TeaVM can emulate threads. TeaVM won't spawn real threads, it will turn Java methods into coroutines and schedule their execution upon one physical thread. This won't speed-up programs by using multiple cores, but for example you can use Java synchronous IO APIs in a background thread. 3. TeaVM has more advanced reflection support. You can list class' methods and fields, call methods and get/set field via reflection (but as in any other AOT compiler you should list reflectable methods and fields). 4. Maven and Gradle plugins both available out-of-the-box, you don't need any 3rd party tool. 5. I usually get positive feedback from my users about compilation time compared to GWT. 6. TeaVM already has some limited support of compilation to WebAssembly.

As for latest Java version, TeaVM currently supports Java 21.

Many thanks. Looks really promising. I tried TeavM two or so years ago and faced problem because my Java veriosn was newer than 14, if I remember correctly.

Now with this new release, things look great, at least for some time :D

for the future, WASM would be a better bet than either of these two.
Well something needs to be compiled to Wasm, no? :)
god don't follow a positive assertion with "no?" -- very annoying
Sorry. Non-native speaker.