Package org.fest.swing.launcher
Class ApplicationLauncher
java.lang.Object
org.fest.swing.launcher.ApplicationLauncher
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();
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ApplicationLauncherapplication(Class<?> applicationType) Starting point of the fluent interface.static ApplicationLauncherapplication(String applicationTypeName) Starting point of the fluent interface.voidstart()Starts the application.Specifies the arguments to pass to the "main" method.
-
Field Details
-
applicationType
-
args
-
-
Constructor Details
-
ApplicationLauncher
-
-
Method Details
-
application
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
Starting point of the fluent interface.- Parameters:
applicationType- the class containing the "main" method.- Returns:
- the created
ApplicationStarter.
-
withArgs
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- ifnewArgsisnull.
-
start
public void start()Starts the application.- Throws:
org.fest.reflect.exception.ReflectionError- if the "main" method cannot be invoked.
-