TeaVM ===== What is TeaVM? -------------- In short, TeaVM gets a bytecode, running over JVM, and translates it to the JavaScript code, which does exactly the same thing as the original bytecode does. It is based on its cross-compiler which transforms `class` files to JavaScript. But there is something more: * a sophisticated per-method dependency manager, which greatly reduces the JavaScript output; * an optimizer capable of things like devirtualization, inlining, constant propagation, loop invariant motion and many other; * implementation of subset of core Java library; How to use ---------- There are some options of using TeaVM. One is the maven build. First, you write your code as if it were an ordinary Java project: package org.teavm.samples; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } } Second, you include the following dependency in your `pom.xml`: org.teavm teavm-classlib 0.0.1-SNAPSHOT provided Third, you add `teavm-maven-plugin` in your build configuration: org.teavm teavm-maven-plugin 0.0.1-SNAPSHOT generate-javascript build-javascript process-classes true org.teavm.samples.HelloWorld Now you can execute `mvn clean package` and get the generated JavaScript file `target/javascript/classes.js`. It contains the `main` global function, which you may call. In the general case you should provide an HTML page, which includes both of [runtime.js](https://github.com/konsoletyper/teavm/blob/master/teavm-core/src/main/resources/org/teavm/javascript/runtime.js) and `classes.js` files and calls `main` function in some condition. Here is an example: