What is TeaVM?
- per-method dependency analyzer, 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 Eclipse;
- generation of source maps;
There are several options of using TeaVM. One is the Maven build. The easiest way to create a new TeaVM project is to type in the command line:
mvn -DarchetypeCatalog=local \ -DarchetypeGroupId=org.teavm \ -DarchetypeArtifactId=teavm-maven-webapp \ -DarchetypeVersion=0.4.3 archetype:generate
Now you can execute
mvn clean package and get the generated
war in Tomcat or another container, or simply unzip it and open the
It is much easier to develop TeaVM applications using Eclipse. If you prefer Eclipse, please read this tutorial.
Thanks to Jaroslav Tulach, author of DukeScript, we have several DukeScript example applications. One is the minesweeper game. You can try its TeaVM-compiled version here, and then take a look at source code and HTML page.
Another example is available here. It uses GraphHopper to build route in browser. Unlike original GraphHopper example it works completely in browser instead of querying server. Thanks to Peter Karich.