org.fest.swing.launcher
Class ApplicationLauncher

java.lang.Object
  extended by org.fest.swing.launcher.ApplicationLauncher

public class ApplicationLauncher
extends Object

Understands execution of a Java application from a class that has a "main" method.

The following example shows how to start an application without any arguments:

 ApplicationLauncher.application(JavaApp.class).start();

 // or

 ApplicationLauncher.application("org.fest.swing.application.JavaApp").start();
 

The following example shows how to start an application with arguments:

 ApplicationLauncher.application(JavaApp.class).withArgs("arg1", "arg2").start();

 // or

 ApplicationLauncher.application("org.fest.swing.application.JavaApp").withArgs("arg1", "arg2").start();
 

Author:
Yvonne Wang

Method Summary
static ApplicationLauncher application(Class<?> applicationType)
          Starting point of the fluent interface.
static ApplicationLauncher application(String applicationTypeName)
          Starting point of the fluent interface.
 void start()
          Starts the application.
 ApplicationLauncher withArgs(String... newArgs)
          Specifies the arguments to pass to the "main" method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

application

public static ApplicationLauncher application(String applicationTypeName)
Starting point of the fluent interface.

Parameters:
applicationTypeName - the fully qualified name of the class containing the "main" method.
Returns:
the created ApplicationStarter.
Throws:
UnexpectedException - if the class specified in the given name cannot be loaded.

application

public static ApplicationLauncher application(Class<?> applicationType)
Starting point of the fluent interface.

Parameters:
applicationType - the class containing the "main" method.
Returns:
the created ApplicationStarter.

withArgs

public ApplicationLauncher withArgs(String... newArgs)
Specifies the arguments to pass to the "main" method. Please note that the arguments to pass are specific to your application. JVM-specific arguments are ignored (e.g. -Xms, -Xmx)

Parameters:
newArgs - the arguments to pass to the "main" method.
Returns:
this ApplicationStarter.
Throws:
NullPointerException - if newArgs is null.

start

public void start()
Starts the application.

Throws:
org.fest.reflect.exception.ReflectionError - if the "main" method cannot be invoked.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.