Skip to content

Stand Alone Compiler

fwienber edited this page Dec 1, 2014 · 10 revisions

If you want to use Jangaroo without Maven, here is a step-by-step description of how to set up and use the compiler from the command line.

Lines starting with > are what you are supposed to type into a command shell, everything else is output.

Instructions are for Windows; if you use Linux or OS X, you have to replace \ by /, %VAR% by $VAR, ; inside -classpath by :, and type by cat. (It would be nice of someone to maintain a *nix version of this documentation!)

  1. You need a Java JRE 1.6 or 1.7 (1.8 may also work, but we have not tested that yet). Download from Oracle and follow the installation instructions.

  2. Download the latest Jangaroo 1.0.x SDK as a zip from Maven Central: Jangaroo 1.x SDK on Maven Central

  3. Unpack the zip into a directory of your choice (say C:\jangaroo-sdk).

  4. Add the bin sub-directory to your PATH:

     >set PATH=%PATH%;C:\jangaroo-sdk\bin
    
  5. Try starting the compiler, it should output usage instructions:

     >jooc
     usage: jooc [options] <file> ...
     ...
    
  6. Store the library sub-directory in an environment variable:

     >set JOOLIBS=C:\jangaroo-sdk\libs
    

Now you are ready to use the Jangaroo compiler from the command line.

To test the compiler with an example project, use the following steps:

  1. Download the "Jangaroo Quickstart" example and unpack to another folder, say C:\jangaroo-quickstart: jangaroo-quickstart-master.zip

  2. Go to the subfolder my-joo\my-joo-lib\src\main\joo:

     >cd \jangaroo-quickstart\my-joo\my-joo-lib\src\main\joo
    
  3. Now, compile com\acme\HelloWorld.as (see here for a documentation of all compiler command line switches):

     >jooc -v -g SOURCE -classpath %JOOLIBS%\jangaroo-runtime.jar -sourcepath my-joo-lib\src\main\joo -d my-joo-app\src\main\webapp\joo\classes my-joo-lib\src\main\joo\com\acme\HelloWorld.as
     -genarateapi: false
     -g option values:
     debugMode=SOURCE
     Parsing C:\jangaroo-quickstart-master\my-joo\my-joo-lib\src\main\joo\com\acme\HelloWorld.as (sourcepath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-runtime.jar!META-INF/joo-api/Object.as (classpath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-runtime.jar!META-INF/joo-api/String.as (classpath)
     writing file: 'C:\jangaroo-quickstart-master\my-joo\my-joo-app\src\main\webapp\joo\classes\com\acme\HelloWorld.js'
    
  4. Repeat compilation for my-joo-app. Here, you additionally need the libraries jangaroo-browser and my-joo:

     >jooc -v -g SOURCE -classpath %JOOLIBS%\jangaroo-runtime.jar;%JOOLIBS%\jangaroo-browser.jar;my-joo-lib\src\main\joo -sourcepath my-joo-app\src\main\joo -d my-joo-app\src\main\webapp\joo\classes my-joo-lib\src\main\joo\com\acme\HelloWorld.as
     -genarateapi: false
     -g option values:
     debugMode=SOURCE
     Parsing C:\jangaroo-sdk\jangaroo-quickstart-master\my-joo\my-joo-app\src\main\joo\com\acme\main\Main.as (sourcepath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-runtime.jar!META-INF/joo-api/Object.as (classpath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-browser.jar!META-INF/joo-api/window.as (classpath)
     Parsing C:\jangaroo-quickstart\my-joo\my-joo-lib\src\main\joo\com\acme\HelloWorld.as (classpath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-runtime.jar!META-INF/joo-api/String.as (classpath)
     Parsing C:\jangaroo-sdk\libs\jangaroo-browser.jar!META-INF/joo-api/js/Element.as (classpath)
     writing file: 'C:\jangaroo-quickstart\my-joo\my-joo-app\src\main\webapp\joo\classes\com\acme\main\Main.js'
    
  5. Unpack the libraries into the webapp directory:

    >cd my-joo-app\src\main\webapp
    >"%JAVA_HOME%\bin\jar" -xf %JOOLIBS%\jangaroo-runtime.jar
    >"%JAVA_HOME%\bin\jar" -xf %JOOLIBS%\jangaroo-browser.jar
    
  6. By concatenating all libraries' *.module.js files in the correct order, create jangaroo-application.js:

    >type joo\jangaroo-runtime.module.js joo\jangaroo-browser.module.js > joo\jangaroo-application.js
    
  7. Eventually, the complete Web app is assembled. You can now open the example in a browser:

    >start index.html
    
Clone this wiki locally