From 9f115ea1b2ede608667660d4d5ee1f65012f37d3 Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Mon, 6 Oct 2014 16:16:39 +0400 Subject: [PATCH] Update readme file with creating project from archetype --- README.md | 58 ++++++++++++------------------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 894194bab..bb08a7722 100644 --- a/README.md +++ b/README.md @@ -18,59 +18,22 @@ You can use TeaVM for building applications for the browser, due to the followin * debugger; * interoperation with JavaScript libraries together with the set of predefined browser interfaces. -How to use ----------- -There are several options of using TeaVM. One is the Maven build. First, you write your code as if it were an -ordinary Java application: +Quick start +----------- -```Java -package org.teavm.samples; +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: -public class HelloWorld { - public static void main(String[] args) { - System.out.println("Hello, world!"); - } -} -``` + mvn -DarchetypeCatalog=local -DarchetypeGroupId=org.teavm -DarchetypeArtifactId=teavm-maven-webapp \ + -DarchetypeVersion=0.2.0 archetype:generate -Second, you include the following plugin in your `pom.xml` build section: - -```XML - - org.teavm - teavm-maven-plugin - 0.2 - - - org.teavm - teavm-classlib - 0.2 - - - - - generate-javascript - - build-javascript - - process-classes - - true - org.teavm.samples.HelloWorld - true - - - - -``` - -Now you can execute `mvn clean package` and get the generated JavaScript files in `target/javascript` folder. -Just open `target/javascript/main.html` page in your browser, open developer's console and press *Refresh* and -see what happen. +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. There is also the [teavm-samples](teavm-samples) module, containing examples of TeaVM-based projects. + DukeScript ---------- @@ -79,9 +42,12 @@ easily talk to JavaScript environment to (usually) animate an HTML page. While D implementation of JVM, called [Bck2Brwsr](http://wiki.apidesign.org/wiki/Bck2Brwsr), TeaVM also provides support for running DukeScript applications, using [teavm-html4j](teavm-html4j) plugin. + Live examples ------------- +Compare the speed of JavaScript produced by TeaVM and GWT here: [http://teavm.org/live-examples/jbox2d-benchmark/] + Thanks to [Jaroslav Tulach](http://wiki.apidesign.org/wiki/User:JaroslavTulach), author of DukeScript, we have several DukeScript example applications. One is the minesweeper game. You can try its TeaVM-compiled version [here](http://xelfi.cz/minesweeper/teavm/), and then take a look at