JNLPRuntime (IcedTea-Web: NetX )
Date: 2015-04-30

net.sourceforge.jnlp.runtime

## Class JNLPRuntime

- java.lang.Object
- - net.sourceforge.jnlp.runtime.JNLPRuntime

-     public class JNLPRuntime
      extends java.lang.Object

  Configure and access the runtime environment. This class stores global jnlp properties such as default download indicators, the install/base directory, the default resource update policy, etc. Some settings, such as the base directory, cannot be changed once the runtime has been initialized.

  The JNLP runtime can be locked to prevent further changes to the runtime environment except by a specified class. If set, only instances of the exit class can exit the JVM or change the JNLP runtime settings once the runtime has been initialized.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.Object` | `initMutex` mutex to wait on, for initialization

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JNLPRuntime()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `detectOnline(java.net.URL location)`
    `static void` | `disableExit()` Disables applets from calling exit.
    `static void` | `exit(int i)`
    `static ApplicationInstance` | `getApplication()`
    `static DeploymentConfiguration` | `getConfiguration()` Gets the Configuration associated with this runtime
    `static DownloadIndicator` | `getDefaultDownloadIndicator()`
    `static LaunchHandler` | `getDefaultLaunchHandler()` Returns the default launch handler.
    `static UpdatePolicy` | `getDefaultUpdatePolicy()`
    `static boolean` | `getForksAllowed()`
    `static java.util.List<java.lang.String>` | `getInitialArguments()`
    `static java.lang.String` | `getLocalisedTimeStamp(java.util.Date timestamp)`
    `static SecurityDialogMessageHandler` | `getSecurityDialogHandler()`
    `static void` | `initialize(boolean isApplication)` Initialize the JNLP runtime environment by installing the security manager and security policy, initializing the JNLP standard services, etc.
    `static boolean` | `isAllowRedirect()`
    `static boolean` | `isConnectable(java.net.URL location)`
    `static boolean` | `isDebug()`
    `static boolean` | `isHeadless()`
    `static boolean` | `isIgnoreHeaders()`
    `static boolean` | `isInitialized()` Returns whether the JNLP runtime environment has been initialized.
    `static boolean` | `isOfflineForced()`
    `static boolean` | `isOnline()`
    `static boolean` | `isOnlineDetected()`
    `static boolean` | `isSecurityEnabled()` Returns whether the secure runtime environment is enabled.
    `static boolean` | `isSetDebug()`
    `static boolean` | `isTrustAll()`
    `static boolean` | `isTrustNone()`
    `static boolean` | `isUnix()`
    `static boolean` | `isVerifying()`
    `static boolean` | `isWebstartApplication()`
    `static boolean` | `isWindows()`
    `static void` | `markNetxRunning()` Indicate that netx is running by creating the `DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE` and acquiring a shared lock on it
    `static void` | `reloadPolicy()`
    `static void` | `saveHistory(java.lang.String documentBase)`
    `static void` | `setAllowRedirect(boolean enabled)`
    `static void` | `setDebug(boolean enabled)` Sets whether debug statements for the JNLP client code should be printed to the standard output.
    `static void` | `setDefaultDownloadIndicator(DownloadIndicator indicator)` Sets the default download indicator.
    `static void` | `setDefaultLaunchHandler(LaunchHandler handler)` Sets the default launch handler.
    `static void` | `setDefaultUpdatePolicy(UpdatePolicy policy)` Sets the default update policy.
    `static void` | `setExitClass(java.lang.Class<?> exitClass)` Set a class that can exit the JVM; if not set then any class can exit the JVM.
    `static void` | `setForksAllowed(boolean value)`
    `static void` | `setHeadless(boolean enabled)` Sets whether the JNLP client will use any AWT/Swing components.
    `static void` | `setIgnoreHeaders(boolean ignoreHeaders)`
    `static void` | `setInitialArgments(java.util.List<java.lang.String> args)`
    `static void` | `setOfflineForced(boolean b)`
    `static void` | `setOnlineDetected(boolean online)`
    `static void` | `setSecurityEnabled(boolean enabled)` Sets whether to enable the secure runtime environment.
    `static void` | `setVerify(boolean enabled)` Sets whether we will verify code signing.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### initMutex

          public static java.lang.Object initMutex

      mutex to wait on, for initialization

  - ### Constructor Detail

    - #### JNLPRuntime

          public JNLPRuntime()

  - ### Method Detail

    - #### isInitialized

          public static boolean isInitialized()

      Returns whether the JNLP runtime environment has been initialized. Once initialized, some properties such as the base directory cannot be changed. Before
      Returns:
        whether this runtime was already initialilsed

    - #### initialize

          public static void initialize(boolean isApplication)
                                 throws java.lang.IllegalStateException

      Initialize the JNLP runtime environment by installing the security manager and security policy, initializing the JNLP standard services, etc.

      This method should be called from the main AppContext/Thread.

      This method cannot be called more than once. Once initialized, methods that alter the runtime can only be called by the exit class.

      Parameters:
        `isApplication` - is `true` if a webstart application is being initialized
      Throws:
        `java.lang.IllegalStateException` - if the runtime was previously initialized

    - #### reloadPolicy

          public static void reloadPolicy()

    - #### setOfflineForced

          public static void setOfflineForced(boolean b)

    - #### isOfflineForced

          public static boolean isOfflineForced()

    - #### setOnlineDetected

          public static void setOnlineDetected(boolean online)

    - #### isOnlineDetected

          public static boolean isOnlineDetected()

    - #### isOnline

          public static boolean isOnline()

    - #### detectOnline

          public static void detectOnline(java.net.URL location)

    - #### isConnectable

          public static boolean isConnectable(java.net.URL location)

    - #### getConfiguration

          public static DeploymentConfiguration getConfiguration()

      Gets the Configuration associated with this runtime
      Returns:
        a `DeploymentConfiguration` object that can be queried to find relevant configuration settings

    - #### isWebstartApplication

          public static boolean isWebstartApplication()

      Returns:
        true if a webstart application has been initialized, and false for a plugin applet.

    - #### isHeadless

          public static boolean isHeadless()

      Returns:
        whether the JNLP client will use any AWT/Swing components.

    - #### isVerifying

          public static boolean isVerifying()

      Returns:
        whether we are verifying code signing.

    - #### setHeadless

          public static void setHeadless(boolean enabled)

      Sets whether the JNLP client will use any AWT/Swing components. In headless mode, client features that use the AWT are disabled such that the client can be used in headless mode (`java.awt.headless=true`).
      Parameters:
        `enabled` - true if application do not wont/need gui or X at all
      Throws:
        `java.lang.IllegalStateException` - if the runtime was previously initialized

    - #### setAllowRedirect

          public static void setAllowRedirect(boolean enabled)

    - #### isAllowRedirect

          public static boolean isAllowRedirect()

    - #### setVerify

          public static void setVerify(boolean enabled)

      Sets whether we will verify code signing.
      Parameters:
        `enabled` - true if app should verify signatures
      Throws:
        `java.lang.IllegalStateException` - if the runtime was previously initialized

    - #### isSecurityEnabled

          public static boolean isSecurityEnabled()

      Returns whether the secure runtime environment is enabled.
      Returns:
        true if security manager is created

    - #### setSecurityEnabled

          public static void setSecurityEnabled(boolean enabled)

      Sets whether to enable the secure runtime environment. Disabling security can increase performance for some applications, and can be used to use netx with other code that uses its own security manager or policy.

      Disabling security is not recommended and should only be used if the JNLP files opened are trusted. This method can only be called before initalizing the runtime.

      Parameters:
        `enabled` - whether security should be enabled
      Throws:
        `java.lang.IllegalStateException` - if the runtime is already initialized

    - #### getSecurityDialogHandler

          public static SecurityDialogMessageHandler getSecurityDialogHandler()

      Returns:
        the `SecurityDialogMessageHandler` that should be used to post security dialog messages

    - #### setExitClass

          public static void setExitClass(java.lang.Class<?> exitClass)

      Set a class that can exit the JVM; if not set then any class can exit the JVM.
      Parameters:
        `exitClass` - a class that can exit the JVM
      Throws:
        `java.lang.IllegalStateException` - if caller is not the exit class

    - #### disableExit

          public static void disableExit()

      Disables applets from calling exit. Once disabled, exit cannot be re-enabled for the duration of the JVM instance

    - #### getApplication

          public static ApplicationInstance getApplication()

      Returns:
        the current Application, or null if none can be determined.

    - #### isDebug

          public static boolean isDebug()

      Returns:
        whether debug statements for the JNLP client code should be printed.

    - #### isSetDebug

          public static boolean isSetDebug()

    - #### setDebug

          public static void setDebug(boolean enabled)

      Sets whether debug statements for the JNLP client code should be printed to the standard output.
      Parameters:
        `enabled` - set to true if you need full debug output
      Throws:
        `java.lang.IllegalStateException` - if caller is not the exit class

    - #### setDefaultUpdatePolicy

          public static void setDefaultUpdatePolicy(UpdatePolicy policy)

      Sets the default update policy.
      Parameters:
        `policy` - global update policy of environment
      Throws:
        `java.lang.IllegalStateException` - if caller is not the exit class

    - #### getDefaultUpdatePolicy

          public static UpdatePolicy getDefaultUpdatePolicy()

      Returns:
        the default update policy.

    - #### setDefaultLaunchHandler

          public static void setDefaultLaunchHandler(LaunchHandler handler)

      Sets the default launch handler.
      Parameters:
        `handler` - default handler

    - #### getDefaultLaunchHandler

          public static LaunchHandler getDefaultLaunchHandler()

      Returns the default launch handler.
      Returns:
        default handler

    - #### setDefaultDownloadIndicator

          public static void setDefaultDownloadIndicator(DownloadIndicator indicator)

      Sets the default download indicator.
      Parameters:
        `indicator` - where to show progress
      Throws:
        `java.lang.IllegalStateException` - if caller is not the exit class

    - #### getDefaultDownloadIndicator

          public static DownloadIndicator getDefaultDownloadIndicator()

      Returns:
        the default download indicator.

    - #### getLocalisedTimeStamp

          public static java.lang.String getLocalisedTimeStamp(java.util.Date timestamp)

    - #### getForksAllowed

          public static boolean getForksAllowed()

      Returns:
        `true` if the current runtime will fork

    - #### setForksAllowed

          public static void setForksAllowed(boolean value)

    - #### isWindows

          public static boolean isWindows()

      Returns:
        `true` if running on Windows

    - #### isUnix

          public static boolean isUnix()

      Returns:
        `true` if running on a Unix or Unix-like system (including Linux and *BSD)

    - #### setInitialArgments

          public static void setInitialArgments(java.util.List<java.lang.String> args)

    - #### getInitialArguments

          public static java.util.List<java.lang.String> getInitialArguments()

    - #### markNetxRunning

          public static void markNetxRunning()

      Indicate that netx is running by creating the `DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE` and acquiring a shared lock on it

    - #### isTrustAll

          public static boolean isTrustAll()

    - #### isTrustNone

          public static boolean isTrustNone()

    - #### isIgnoreHeaders

          public static boolean isIgnoreHeaders()

    - #### setIgnoreHeaders

          public static void setIgnoreHeaders(boolean ignoreHeaders)

    - #### exit

          public static void exit(int i)

    - #### saveHistory

          public static void saveHistory(java.lang.String documentBase)