How do I integrate the Advanced Updater with my java application?

Sample code on how to integrate the updater with a java application.

package com.updater;

import java.awt.*;
import java.awt.event.*;
import java.io.*;

/**
 * Sample code for using the Advanced Updater from java applications.
 *
 * Note: For this sample code to work you must have the updater.exe and updater.ini in
 *       classpath. Just place them in the same folder as you java application .jar files.
 *
 * @author Advanced Installer team
 */
public class TestUpdater extends Frame
                         implements Runnable {

    public static void main(String[] args) {
      TestUpdater frame = new TestUpdater();
      frame.setVisible(true);
    }

    public void run()
    {
      try {
        Thread.sleep(30000); // wait for about 30 seconds.
        StartUpdater("updater.exe /silent"); // launch the updater in silent mode.
      } catch (InterruptedException ex) {
        ex.printStackTrace();
      }
    }

    /**
     * The constructor.
     */
     public TestUpdater() {

        Thread checkSilent = new Thread(this);
        checkSilent.start(); // start the updater in silent mode.

        MenuBar menuBar = new MenuBar();
        Menu menuFile = new Menu();
        MenuItem menuFileExit = new MenuItem();

        menuFile.setLabel("File");
        menuFileExit.setLabel("Exit");

        // Add action listener.for the menu button
        menuFileExit.addActionListener
        (
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    TestUpdater.this.windowClosed();
                }
            }
        );

        Menu menuHelp = new Menu();
        menuHelp.setLabel("Help");
        MenuItem menuCheckForUpdates = new MenuItem();
        menuCheckForUpdates.setLabel("Check for Updates...");

        menuCheckForUpdates.addActionListener
        (
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    TestUpdater.this.StartUpdater("updater.exe /checknow");
                }
            }
        );

        MenuItem menuUpdatesOptions = new MenuItem();
        menuUpdatesOptions.setLabel("Updates Options...");

        menuUpdatesOptions.addActionListener
        (
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    TestUpdater.this.StartUpdater("updater.exe /configure");
                }
            }
        );

        menuHelp.add(menuUpdatesOptions);
        menuHelp.addSeparator();
        menuHelp.add(menuCheckForUpdates);

        menuFile.add(menuFileExit);
        menuBar.add(menuFile);
        menuBar.add(menuHelp);

        setTitle("Sample code for using the Advanced Updater from java applications");
        setMenuBar(menuBar);
        setSize(new Dimension(600, 400));

        // Add window listener.
        this.addWindowListener
        (
            new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    TestUpdater.this.windowClosed();
                }
            }
        );
    }

    protected class DefAdapter extends WindowAdapter{
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    }

    protected void StartUpdater(String cmd) {
      try {
        Runtime.getRuntime().exec(cmd);
      }
      catch(IOException ex) {
        ex.printStackTrace();
      }
    }


    /**
     * Shutdown procedure when run as an application.
     */
    protected void windowClosed() {

        // Exit application.
        System.exit(0);
    }
}