Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Install

decatur edited this page Oct 5, 2011 · 10 revisions

Install

Download

Download or git pull these projects:

Build

Import the projects into an Eclipse workspace and build the projects.

Cross-Compiler Usage

Switch into j2js-demos project. Set the runtime classpath

set RUNTIME_CLASSPATH=^
%COMPILER_DIR%/libs/1.4/commons-io-1.4.jar;^
%COMPILER_DIR%/libs/bcel-5.1.jar;^
%COMPILER_DIR%/target/classes    

and query the cross-compiler usage:

java -cp %RUNTIME_CLASSPATH% com.j2js.J2JSCompiler

This will output

Usage: java com.j2js.J2JSCompiler <basedir> <classpathElements> <entryPointClassName> <targetLocation>

Cross-Compile HelloWorld1

Note: You can also execute the MS-Windows batch compile-hello-world.bat

With the runtime classpath alread set, we now have to set the cross-compile-time classpath:

set CROSS_COMPILE_CLASSPATH=^
target/classes;../j2js-jre/target/classes;../j2js-agent/target/classes;

Generate the JavaScript assemblies for the class j2js.demo.HelloWorld1 into the location ./target/assemblies/HelloWorld1:

java -cp %RUNTIME_CLASSPATH% com.j2js.J2JSCompiler . ^
%CROSS_COMPILE_CLASSPATH% j2js.demo.HelloWorld1 ./target/assemblies/HelloWorld1

Open HelloWorld1

Navigate a browser to /j2js-demos/src/main/webapp/HelloWorld1.html. You should be alerted of "Hello World".

Clone this wiki locally