Example

To illustrate the use of the Builder, the example from Figure 6-2 is built:

After compilation of this class using a Java-to-Bytecode compiler, e.g., jamaicac, it can be executed using the JamaicaVM generating the following output:

  > jamaicavm HelloWorld
      
              Hello        World!
           Hello       World!
        Hello     World!
     Hello    World!
   Hello   World!
 Hello  World!
Hello World!
Hello World!
Hello World!
Hello World!
 Hello  World!
   Hello   World!
     Hello    World!
        Hello     World!
           Hello       World!
              Hello        World!
                 Hello         World!
...
    
  

During execution, the class file HelloWorld.class and several system classes like String.class are loaded by JamaicaVM from the directories specified in the current classpath.

A standalone application can be created with the Builder:

  > jamaica HelloWorld
      
Jamaica Builder Tool 2.2 Release 1
Generating code for target 'linux-gnu-i686'
 + HelloWorld__.c
 * C compiling
 * linking
 * stripping
Class file compaction gain: 59.02125% (1722798 ==> 705981)
>
    
  

A created application contains all the classes required for execution. The application can be started like any other program by its name. Additional arguments and parameters can be passed on the command line. They will passed to the application main method in the String array parameter. The general format to execute an application is:

      
      <application name> [<argument 1> [<argument 2> ...]]
    
  

The HelloWorld executable can be executed directly with:

  > ./HelloWorld
      
              Hello        World!
           Hello       World!
        Hello     World!
     Hello    World!
   Hello   World!
 Hello  World!
Hello World!
Hello World!
Hello World!
Hello World!
 Hello  World!
   Hello   World!
     Hello    World!
        Hello     World!
           Hello       World!
              Hello        World!
                 Hello         World!
...