Java runner
Previous  Top  Next

The previous section outlined how to take a runner implemented in Java and configure it as an app runner.

The java runner provides a convenient alternative, provided that the implementation is in Java and follows some simple conventions in terms of packaging and expected arguments.

Here is the revised runner.xml for com.headway.examples.osgi:

<
runner type="java">
   <
params>
      <
!-- note: descriptions removed -->
      <
param key="dir" name="Bundles directory" type="file" required="true"/>
      <
param key="eclipse" name="Include Eclipse extensions" type="boolean" default="false"/>
   <
/params>
   <
java mainclass="com.headway.open.osgi.S101Outputter">
      <
java main="com.headway.open.osgi.S101Outputter">
         <
!-- optionally specify vmargs like this 
         <vmarg name="Xmx" value="64"/>
         --
>
      <
/java>
   <
/java>
<
/runner>

The key is to specify runner type=java and then provide a java element that specifies the mainclass. Optionally, you can also specify some vm arguments. Everything else (packaging and arguments) works off conventions.

Packaging

The class path is automatically constructed from the set of jar files present in the flavor's lib directory and/or any class files present in the flavor's classes directory.

Arguments

The arguments are inferred automatically from the defined parameters, whereby
·A boolean parameter is appended in the form -<param-name> if the parameter value is set to true (otherwise it is omitted)  
·All other parameters are appended in the form -<param-name> <param-value>  
·The output file is specified via an additional argument pair in the form -out <path-to-tempfile>.