BeeSoft®
Since 1992
 

Content

 Welcome
 Products
       Abeona
       Gaia
             News
             Documentation
                   Introduction
                   Swing support
                   Server application
                   Validation
                   XML
                   Logging
                   Utilities
                   Launcher
             License
             Download
       Hephaistos
       JavaGantt
 Services
       Promote your software
 Contact Us
 Links
      
  GaiaI®
© 2012 BeeSoft ®
 

Launcher

Launcher is an utility subsystem to launch Java application. It supports processing of the instruction file, building a splash screen, building the class paths and invoking main method on another class.

The main advantage of this launcher is the ability to run some parts of application in sequences and in different classloaders - so it is easy to process the application autoupdate and then start the application within this launcher, all covered by one splash screen.

You can use this subsystem as-is (just one JAR file), or you can subclass some classes from it and create a new JAR from Launcher classes and your subclasses to launch your application.

The main class of subsystem is eu.beesoft.gaia.launcher.Launcher. Launcher processes a launch file. It is a file with the instructions. Ih an instruction has arguments, they are appended at the same line and separated by space from instruction name. Enabled instructions are:

  • property - adds property (given as an argument of this method, in form name=value) to system properties
  • splash - builds a progress mediator of SplashScreen. An image name is an argument of the call.
  • mediator - builds a progress mediator (its class is an argument of the call)
  • path - adds given argument to classpath
  • scan - adds to classpath each JAR file from directory (given as argument) and all its subdirectories
  • run - invokes main() method on instance of the class, which name and arguments for invocation are in given argument
  • clear - clears built class paths - used to create a new classpath

Here is an example of the standard launch file:

path c:/myapp/lib/first.jar
path c:/myapp/lib/second.jar
path c:/myapp/classes
run mypackage.MyClass firstArgument "second argument"

It creates a classpath from two JAR files and one directory and then invokes method main() on MyClass with two arguments.

Launcher can mediate its state by ProgressMediator implementation. ProgressMediator is an interface that describes a behavior of the UI component, which displays a progress of some long-term operation. The described methods are:

  • getProgressRange() - returns maximum progress value
  • setProgressRange() - sets maximum progress value
  • getProgressStep() - returns a current progress step
  • setProgressStep() - sets current progress step
  • getProgressText() - returns the currently displayed progress text
  • setProgressText() - returns true if user (in UI) interrupted operation for which is this progress monitor running
  • isInterrupted () - closes a progress mediator instance
  • close () - sets the progress text to dislay

There are two implementations of ProgressMediator:

  • ConsoleOutput - to output to the console (Unix-like without installed GUI). It does not serve a progress steps, just displays texts.
  • SplashScreen - a basic implementation of splash screen with ProgressMediator. Creates a main window, displays an image and a progress bar. You can override method build() to change the look of this spash screen.