TeaVM is an ahead-of-time compiler of Java bytecode to JavaScript. It's much like GWT, however GWT takes source code, and this limits GWT to Java only. Unlike GWT, TeaVM relies on existing compilers such as javac, kotlinc and scalac. These compilers produce bytecode (*.class
or *.jar
files), then TeaVM takes this bytecode and produces JavaScript code.
TeaVM is primarily a web development tool. It's not for taking your large existing codebase in Java or Kotlin and producing JavaScript. Unfortunately, Java was not designed to run efficiently in the browser. There are Java APIs that are impossible to implement without generating inefficient JavaScript. Some of these APIs are: reflection, resources, class loaders, and JNI. TeaVM restricts usage of these APIs. Generally, you'll have to manually rewrite your code to fit into TeaVM constraints.
TeaVM is for you, if:
If you have tightly-coupled applications that use Swing, you want to run these applications in web, and you don't care about download size, start-up time and performance, you should probably look elsewhere; there are more appropriate tools for you, like CheerpJ.
Strong partsWhy use TeaVM when there are plenty of transpilers and frameworks for web front-end development?
If you are a JavaScript developer who is satisfied with JavaScript, TypeScript or even elm, you probably won't need TeaVM.
If you are a Java (or Kotlin, or Scala) developer who is used to writing back-end code, TeaVM might be your choice. It's true that a good developer (including Java developer) can learn JavaScript. However, to become an expert you have to spend a reasonable amount of your time.
Another drawback of JavaScript for you is it's a different language with different syntax, different build tools, different IDE experience. Say, you have your Java/Maven build set up in Jenkins, with SonarQube checking your code quality and IDEA code style settings. You have to repeat all these things for the JavaScript ecosystem. Finally, you have to "switch context" every time you change the code on back-end and front-end side.
TeaVM allows you to use single ecosystem, and reuse as much as possible of it for both back-end and front-end worlds.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3