What is TeaVM?
TeaVM is an ahead-of-time translating compiler (transpiler) from Java bytecode to
The main difference is that TeaVM does not require to provide source code together with
compiled class files. Moreover, source code is not required to be Java.
For example, TeaVM successfully compiles Kotlin language and Scala.
Can I see TeaVM in action?
Sure, you can.
- TeaVM vs. GWT
performance comparison is based on a simple
Real-time physics simulation is very time consuming, so you can see that TeaVM is really fast.
- Invaders, a demo game from
libGDX community. Compiled with help of
TeaVM libGDX backend, alternative to GWT backend.
- Play Geobot, a little physics-based puzzle game.
Thanks to joan789 for her great artwork!
- Play Minesweeper created by
This game is really cross-platform, since it is based on
that runs Java HTML5 applications on different platforms.
- Async demo that shows how TeaVM can translate multithreaded
applications with syncrhonization primitives.
- GraphHopper demo. This application uses GraphHopper for
route planning and stores road graph inside IndexedDB. This gives an opportunity to calculate routes when your
device is offline.
- Kotlin demo. This simple application shows how
to run Kotlin in TeaVM. You can find the whole project
- Scala demo. This simple application shows how to
run Scala in TeaVM. You can find source code
- Spheres of madness and
Mountain TD are games by Wilhelm van Huyssteen, who
spent some time porting his games to TeaVM.
Why should I use TeaVM?
If you like to write on Java, and you want to write code that runs in the browser,
you can use TeaVM.
TeaVM provides you with all features necessary to develop applications for the browser:
- per-method dependency analyser, that determines a set of methods that are really needed
to run your application, so TeaVM won't translate whole JAR files;
- Java class library emulation;
- integration with Maven and IDEA;
- generation of source maps;
How can I start to use TeaVM?
You can create a new TeaVM-flavoured Java web application, using a Maven archetype:
mvn -DarchetypeCatalog=local \
Now you can execute
mvn clean package and get the generated war file.
Deploy this war in Tomcat or another servlet container, or simply unzip it and open
It is much easier to develop TeaVM applications using IntelliJ IDEA.
If you prefer IDEA, please begin with
How can I learn more about TeaVM?
Please, look at the project's wiki
on GitHub. It provides documentation about generally used parts of TeaVM.
If you are interested which parts of JDK you can use in TeaVM, read this
automatically generated report.
There are also some javadocs:
Finally, you can browse the source code
at GitHub. There are
that might help you to start using TeaVM.
Where to download TeaVM?
You don't need to download TeaVM, Maven does it for you. Just follow instruction
above to create a new Maven project.
If you prefer IntelliJ IDEA to create your projects, install TeaVM plugin from the IDEA "plugins" configuration section.
If you want to debug your TeaVM applications, running in Google Chrome, install
the TeaVM Chrome extension.
You can also clone the source code repository:
Who uses TeaVM?
- GameComposer, a game authoring tool and
a game runtime environment, that has TeaVM-based backend for HTML5.
- CodeName One team is trying to use TeaVM to run application
in the browser. They have some success already.
How to receive feedback?
If you have questions, ask them by email: email@example.com.
You can also report an issue
on GitHub repository and discuss TeaVM in
How can I help the project?
- create web applications using TeaVM and write about your good experience in media;
- report issues that you encounter during development;
- help to write documentation;
- contribute your code to TeaVM;
- write useful libraries that help to create browser applications in Java;
- port your existing projects to TeaVM;
- correct spelling in documentation;
- help to create a better design of this site;
- design a logo.
What's wrong with GWT?
You probably already use GWT to develop browser application in Java, but GWT has its own
- GWT is slow. You often wait for minutes for GWT to compile sources. Also
GWT produces permutations, increasing overall compilation time.
- GWT requires source code together with special
- GWT is only limited to Java. If you like Scala or Kotlin, you can use their native
with the existing Java code.
- GWT is not compatible with bytecode instrumentation tools.
- GWT has only a limited support of JDK classes. For example, it does not include
full support of Unicode character classes or several parts of reflection API like