private void installPlugin(final File plugin) {
        final JDialog dialog = new JDialog(frame, "Installing Plugin", true);
        dialog.getContentPane().setLayout(new BorderLayout());
        JProgressBar bar = new JProgressBar();
        bar.setIndeterminate(true);
        bar.setString("Installing Plugin.  Please wait...");
        bar.setStringPainted(true);
        dialog.getContentPane().add(bar, BorderLayout.CENTER);
        dialog.pack();
        dialog.setSize(225, 55);

        final SwingWorker<File, Void> installerThread = new SwingWorker<>()
        {
            @Override
            public File doInBackground()
            {
                File pluginsDir = new File(binDir.getParentFile(), "plugins");
                String tempName = plugin.getName() + ".part";
                File tempPluginsFile = new File(pluginsDir, tempName);

                File realPluginsFile = new File(pluginsDir, plugin.getName());

                // Copy Plugin into Dir.
                try {
                    // Just for fun. Show no matter what for two seconds.
                    Thread.sleep(2000);

                    copy(plugin.toURI().toURL(), tempPluginsFile);

                    // If successfull, rename to real plugin name.
                    tempPluginsFile.renameTo(realPluginsFile);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return realPluginsFile;
            }

            @Override
            public void done()
            {
                dialog.setVisible(false);
            }
        };

        // Start installation
        installerThread.execute();

        dialog.setLocationRelativeTo(frame);
        dialog.setVisible(true);
    }
Creates a new GUI launcher instance.
@param args The command line arguments
@throws AWTException if AWT cannot be initialised
starter/src/main/java/org/jivesoftware/openfire/launcher/Launcher.java