Coder Social home page Coder Social logo

teavm's Introduction

TeaVM

What is TeaVM?

TeaVM is an ahead-of-time translator from Java bytecode to JVM. It can be compared with GWT, however TeaVM does not require source code of your application and all required libraries. You can use TeaVM for building applications for the browser, due to the following features:

  • 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;
  • fast JavaScript; for now it is almost as fast as the JavaScript, generated by GWT;
  • Java class library emulation;
  • integration with Maven and Eclipse;
  • generation of source maps;
  • debugger;
  • interoperation with JavaScript libraries together with the set of predefined browser interfaces.

Quick start

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.2.1 archetype:generate

Now you can execute mvn clean package and get the generated war file. Deploy this war in Tomcat or another container, or simply unzip it and open the index.html page.

It is much easier to develop TeaVM applications using Eclipse. If you prefer Eclipse, please read this tutorial.

To learn TeaVM deeper, you take a look at the teavm-samples module, containing examples of TeaVM-based projects. Also you can read project's wiki.

DukeScript

DukeScript is a set of APIs that allows Java applications easily talk to JavaScript environment to (usually) animate an HTML page. While DukeScript has its own implementation of JVM, called Bck2Brwsr, TeaVM also provides support for running DukeScript applications, using teavm-html4j plugin.

Live examples

Compare the speed of JavaScript produced by TeaVM and GWT here: http://teavm.org/live-examples/jbox2d-benchmark/

Play Geobot, a little physics-based puzzle game. Thanks to joan789 for her great artwork!

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 avaialble 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.

Feedback

Ask your questions by email: [email protected]. Also you can report issues on a project's issue tracker.

teavm's People

Contributors

alexey-andreev avatar konsoletyper avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.