netx.jnlp
Class Launcher
public class Launcher
extends java.lang.Object
Launches JNLPFiles either in the foreground or background.
An optional LaunchHandler can be specified that is notified of
warning and error condition while launching and that indicates
whether a launch may proceed after a warning has occurred. If
specified, the LaunchHandler is notified regardless of whether
the file is launched in the foreground or background.
Launcher() - Create a launcher with the runtime's default update policy
and launch handler.
|
Launcher(LaunchHandler handler) - Create a launcher with the specified handler and the
runtime's default update policy.
|
Launcher(LaunchHandler handler, UpdatePolicy policy) - Create a launcher with an optional handler using the
specified update policy and launch handler.
|
Launcher
public Launcher()
Create a launcher with the runtime's default update policy
and launch handler.
Launcher
public Launcher(LaunchHandler handler)
Create a launcher with the specified handler and the
runtime's default update policy.
handler
- the handler to use or null for no handler.
Launcher
public Launcher(LaunchHandler handler,
UpdatePolicy policy)
Create a launcher with an optional handler using the
specified update policy and launch handler.
handler
- the handler to use or null for no handler.policy
- the update policy to use or null for default policy.
createApplet
protected AppletInstance createApplet(JNLPFile file,
boolean enableCodeBase)
throws LaunchException
Create an AppletInstance.
enableCodeBase
- whether to add the code base URL to the classloader
createThreadGroup
protected AppThreadGroup createThreadGroup(JNLPFile file)
Create a thread group for the JNLP file.
getUpdatePolicy
public UpdatePolicy getUpdatePolicy()
Returns the update policy used when launching applications.
isCreateAppContext
public boolean isCreateAppContext()
Returns whether applications are launched in their own
AppContext.
launch
public ApplicationInstance launch(URL location)
throws LaunchException
Launches a JNLP file by calling the launch method for the
appropriate file type.
location
- the URL of the JNLP file to launch
launchApplet
protected ApplicationInstance launchApplet(JNLPFile file,
boolean enableCodeBase)
throws LaunchException
Launches a JNLP applet. This method should be called from a
thread in the application's thread group.
The enableCodeBase parameter adds the applet's codebase to
the locations searched for resources and classes. This can
slow down the applet loading but allows browser-style applets
that don't use JAR files exclusively to be run from a applet
JNLP file. If the applet JNLP file does not specify any
resources then the code base will be enabled regardless of
the specified value.
file
- the JNLP fileenableCodeBase
- whether to add the codebase URL to the classloader
launchBackground
public void launchBackground(URL location)
Launches the JNLP file at the specified location in the
background by calling the launch method for its file type.
location
- the location of the JNLP file
launchBackground
public void launchBackground(JNLPFile file)
Launches a JNLP file by calling the launch method for the
appropriate file type in a different thread.
file
- the JNLP file to launch
launchExternal
public void launchExternal(URL location)
throws LaunchException
Launches the JNLP file at the specified location in a new JVM
instance. The launched application's output is sent to the
system out and it's standard input channel is closed.
location
- the URL of the JNLP file to launch
launchExternal
public void launchExternal(JNLPFile file)
throws LaunchException
Launches the JNLP file in a new JVM instance. The launched
application's output is sent to the system out and it's
standard input channel is closed.
file
- the JNLP file to launch
setCreateAppContext
public void setCreateAppContext(boolean context)
Sets whether to launch the application in a new AppContext
(a separate event queue, look and feel, etc). If the
sun.awt.SunToolkit class is not present then this method
has no effect. The default value is true.
setUpdatePolicy
public void setUpdatePolicy(UpdatePolicy policy)
Sets the update policy used by launched applications.