eva/3 Application BuilderDeveloping eva/3 ApplicationsExecuting Applications 

Starting an eva/3 Application Builder Application Using Java Web Start

For running an eva/3 Application Builder application, an own starting class is needed that detects the required project path at the client computer and afterwards starts the eva/3 Application Builder application using the eva/3 runtime. The project with the starting class is to be exported into a .jar file. The export is described in the chapter Exporting the application as a .JAR file.

An own Java Web Start Class

The own Java Web start class for starting the application detects the project path first and transfers it to the eva/3 runtime starting class.

public class Webstart {

    public static void main(String[] args) {
        com.odc.eva3.rt.se.Main.main(new String[]{
            "-o",
            "start.form",
            "-p",
            new Webstart().getProjectPath()});
    }

   private String getProjectPath() {
        ProtectionDomain pdomain = this.getClass().getProtectionDomain();
        URL url=pdomain.getCodeSource().getLocation();

        if (url.getProtocol().equals("http")) {
           return url.toString();
        } else {
           String path = url.getFile();

           if(path.substring(path.length() -2, path.length()).equals("!/"))
               path = path.substring(5, path.length() -2);
           if (path.charAt(0) == '/')
               path = path.substring(1);

           return VBStringFunctions.replace(path, "%20", " ");
        }
    }
}

In place of the start.form is the eva/3 Application Builder starting form/report to be inserted.

Signing the .JAR Archive

The new project archive as well as the eva/3 runtime archive eva3rt.jar is to be signed. This can be done using the two tools keytool and jarsigner located at the bin directory of the java installation.

In the first step a digital signatur must be created with which all the .jar files should be signed. Therefor the follwong command is to be executed from within the bin directory located at the java installation folder.

keytool -genkey -alias alias

Some informations will be requested from the tool. The key will be generated in the user directory at a file named .keystore. The alias name is an arbitrarily name for the new created certificate.

The .jar files needed for starting the application must be signed with the new created certificate. The signing process can be invoked by the follwoing command:

jarsigner jarDatei alias

Note: All .jar files needed by the project must be signed with the same certificate.

Creating the XML Description for the Application

Java Web start needs a file in XML format which describes the application and its parameters. These file has the file extension .jnlp and contains the following information:

<jnlp spec="1.0+"
      codebase="http://optadata.com/webstart"
      href="application.jnlp">
   <information> 
      <title>eva/3 Anwendung</title> 
      <vendor>optadat@.com</vendor>
      <homepage href="http://www.optadata.com/webstart"/>
      <description>A little test application using</description>
      <description kind="short">little test application </description>
      <icon href="startbild.gif"/>
      <offline-allowed/> 
   </information> 

<security><all-permissions/></security>

   <resources>
      <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se"/>
      <j2se version="1.4+"/>
      <jar href="application.jar" main="true"/>
      <jar href="eva3rt.jar" main="false"/>
   </resources>
   <application-desc main-class="Webstart"/>
</jnlp>

The entry <codebase> contains the basis folder in which the Jar files as well as the .jnlp file it selfs can be found. <security><all-permissions/></security> acquires the law for the application to do file input / output for example. A not signed application can't get such laws. Under <resources>, all signed .jar files must be defined. At the place of Webstart, the main class is to be inserted. This is the start class which runs the eva/3 Application Builder project. Therefor a full qualified class path must be defined.

Execution with Java Web Start

All signed .jar files and the .jnlp file must be placed in a webserver folder. Then Java Web start can be started (s. fig. 13 ).

Fig. 13: Java Web Start
Fig. 13: Java Web Start

The URL from the webserver can be entered in the field Location. The .jnlp file will be read and the application will be offered as executable application. Before the application will be executed, the certificate will be checked and the user must accept the self signed application.