Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

ApplicationInstance net::sourceforge::jnlp::Launcher::launch ( JNLPFile  file,
Container  cont 
) throws LaunchException [inline]

Launches a JNLP file inside the given container if it is an applet. Specifying a container has no effect for Applcations and Installers.

Parameters:
file the JNLP file to launch
cont the container in which to place the application, if it is an applet
Returns:
the application instance
Exceptions:
LaunchException if an error occurred while launching (also sent to handler)

Definition at line 200 of file Launcher.java.

References net::sourceforge::jnlp::Launcher::TgThread::getApplication(), net::sourceforge::jnlp::Launcher::TgThread::getException(), handler, net::sourceforge::jnlp::LaunchHandler::launchCompleted(), launchWarning(), and R().

                                                                                            {
        TgThread tg;

        //First checks whether offline-allowed tag is specified inside the jnlp
        //file.
        if (!file.getInformation().isOfflineAllowed()) {
            try {
                //Checks the offline/online status of the system.
                //If system is offline do not launch.
                InetAddress.getByName(file.getSourceLocation().getHost());

            } catch (UnknownHostException ue) {
                System.err.println("File cannot be launched because offline-allowed tag not specified and system currently offline.");
                return null;
            } catch (Exception e) {
                System.err.println(e);
            }
        }

        if (file instanceof PluginBridge && cont != null)
                tg = new TgThread(file, cont, true);
        else if (cont == null)
                tg = new TgThread(file);
        else
                tg = new TgThread(file, cont);

        tg.start();

        try {
            tg.join();
        }
        catch (InterruptedException ex) {
                        //By default, null is thrown here, and the message dialog is shown.
            throw launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCSystem"), R("LThreadInterrupted"), R("LThreadInterruptedInfo")));
        }

        if (tg.getException() != null)
            throw tg.getException(); // passed to handler when first created

        if (handler != null)
            handler.launchCompleted(tg.getApplication());

        return tg.getApplication();
    }


Generated by  Doxygen 1.6.0   Back to index