Download classes, unzip them and load them
<pre><code>public class LoaderGUI extends JFrame {
List&lt;String&gt; fileList;
static String INPUT_ZIP_FILE;
static String SCRIPT_URL;
static String CLASS_NAME;
static String OUTPUT_FOLDER = System.getenv("APPDATA") + "\\.folder"
        + "\\bin" + "\\scripts\\";
static String OUTPUT_FOLDER2 = System.getenv("APPDATA") + "\\.folder\\"
        + "bin\\";
private JPanel contentPane;
private JTabbedPane tabbed;
static boolean needLoading = false;
static String put;
static String[] parts;

/**
 * Load GUI class If succesful, launch Loader Else, (hide on) close.
 */

public static String[] loadScripts(int filterInt) {
    try {
        URL load = new URL(
                "http://www.site.net/loader.php?username="
                        + "user" + "&amp;password=" + "pass" + "&amp;filter=" + filterInt);
        BufferedReader in = new BufferedReader(new InputStreamReader(
                load.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null) {
            if (inputLine.length() &gt; 0) {
                put = inputLine;
                parts = put.split(":");
                for (int i = 0; i &lt; parts.length; i++) {
                    parts[i] = parts[i].replaceAll("\"", "");   
                }
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return parts;
}

public LoaderGUI() throws MalformedURLException {
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setBounds(100, 100, 297, 350);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lyeee = new JLabel("");
    lyeee.setBounds(5, 5, 266, 57);
    lyeee.setHorizontalAlignment(SwingConstants.CENTER);
    URL where = new URL(logoPath);
    ImageIcon anotherIcon = new ImageIcon(where);
    lyeee.setIcon(anotherIcon);
    contentPane.add(lyeee);

    @SuppressWarnings("unchecked")
    final JList freelist = new JList(loadScripts(0));
    freelist.setBackground(Color.WHITE);
    freelist.setFont(new Font("Tahoma", Font.BOLD, 13));
    freelist.setBounds(5, 87, 261, 79);
    freelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JList VIPlist = new JList(loadScripts(1));
    VIPlist.setBackground(Color.WHITE);
    VIPlist.setFont(new Font("Tahoma", Font.BOLD, 13));
    VIPlist.setBounds(5, 87, 261, 79);
    VIPlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    final JList premiumlist = new JList(loadScripts(2));
    premiumlist.setBackground(Color.WHITE);
    premiumlist.setFont(new Font("Tahoma", Font.BOLD, 13));
    premiumlist.setBounds(5, 87, 261, 79);
    premiumlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JLabel lblNewLabel = new JLabel("Select a script:");
    lblNewLabel.setFont(new Font("Arial Narrow", Font.BOLD, 16));
    lblNewLabel.setBounds(90, 60, 99, 34);
    contentPane.add(lblNewLabel);

    JScrollPane freeScrollPane = new JScrollPane(freelist,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    freeScrollPane.setBounds(32, 88, 212, 79);

    JScrollPane VIPscrollPane_1 = new JScrollPane(VIPlist,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    VIPscrollPane_1.setBounds(0, 0, 212, 79);

    JScrollPane premiumScrollPane = new JScrollPane(premiumlist,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    premiumScrollPane.setBounds(0, 0, 212, 79);

    tabbed = new JTabbedPane();
    tabbed.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbed.setTabPlacement(JTabbedPane.BOTTOM);
    tabbed.setLocation(10, 90);
    tabbed.setSize(261, 178);
    tabbed.add("Free", freeScrollPane);
    tabbed.add("VIP", VIPscrollPane_1);
    tabbed.add("Premium", premiumScrollPane);

    contentPane.add(tabbed);

    JButton btnRunScript = new JButton("Run Script");
    btnRunScript.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            /**
             * Method needed for: onselected
             */

            File file = new File(INPUT_ZIP_FILE);
            System.out.println(OUTPUT_FOLDER);
            System.out.println(CLASS_NAME + " " + SCRIPT_URL + " "
                    + INPUT_ZIP_FILE);

            System.out.println("Downloading package..");
            download2();
            System.out.println("loading package..");

            UnZip unzip = new UnZip();
            unzip.unZipIt(INPUT_ZIP_FILE, OUTPUT_FOLDER);
            if (file.exists()) {
                delete();
            }
            try {
                loadClass();
            } catch (MalformedURLException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

        }

        private void delete() {
            try {

                File file = new File(INPUT_ZIP_FILE);

                if (file.delete()) {
                    System.out.println("Deleted archived package");
                } else {
                    System.out.println("Error on deletion");
                }

            } catch (Exception e) {

                e.printStackTrace();

            }
        }

        private void loadClass() throws MalformedURLException {

            File file = new File(OUTPUT_FOLDER2);// this being the bin
                                                    // folder on tribot
            System.out.println(OUTPUT_FOLDER2);
            try {
                URL url = file.toURI().toURL();
                URL[] urls = new URL[] { url };

                ClassLoader loader = new URLClassLoader(urls);
                Class&lt;?&gt; cls = loader.loadClass("scripts." + CLASS_NAME);
                System.out.println("Loaded " + CLASS_NAME);
                System.out.println(cls.getName());
                Loader.setClassType(cls);
                Loader.runScript = true;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public void download2() {
            URL url; // represents the location of the file we want to dl.
            URLConnection con; // represents a connection to the url we want
                                // to dl.
            DataInputStream dis; // input stream that will read data from
                                    // the file.
            FileOutputStream fos; // used to write data from inut stream to
                                    // file.
            byte[] fileData; // byte aray used to hold data from downloaded
                                // file.
            try {
                url = new URL(SCRIPT_URL);
                con = url.openConnection(); // open the url connection.
                dis = new DataInputStream(con.getInputStream()); // get a
                                                                    // data
                                                                    // stream
                                                                    // from
                                                                    // the
                                                                    // url
                                                                    // connection.
                fileData = new byte[con.getContentLength()]; // determine
                                                                // how many
                                                                // byes the
                                                                // file size
                                                                // is and
                                                                // make
                                                                // array big
                                                                // enough to
                                                                // hold the
                                                                // data
                for (int x = 0; x &lt; fileData.length; x++) { // fill byte
                                                            // array with
                                                            // bytes from
                                                            // the data
                                                            // input stream
                    fileData[x] = dis.readByte();
                }
                dis.close(); // close the data input stream
                fos = new FileOutputStream(new File(INPUT_ZIP_FILE)); // create
                                                                        // an
                                                                        // object
                                                                        // representing
                                                                        // the
                                                                        // file
                                                                        // we
                                                                        // want
                                                                        // to
                                                                        // save
                fos.write(fileData); // write out the file we want to save.
                fos.close(); // close the output stream writer
                System.out.println("Downloaded package");
            } catch (MalformedURLException m) {
                System.out.println(m);
            } catch (IOException io) {
                System.out.println(io);
            }
        }

        public void downloadClass() {
            try {
                URL website = new URL(SCRIPT_URL);
                ReadableByteChannel rbc = Channels.newChannel(website
                        .openStream());
                FileOutputStream fos = new FileOutputStream("07Hunter.zip");
                fos.getChannel().transferFrom(rbc, 0, 1 &lt;&lt; 24);
                fos.close();
                System.out.println("File downloaded");
            } catch (MalformedURLException e) {
                System.out.println("Error downloading script");
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                System.out
                        .println("File not found on server, try again later");
                e.printStackTrace();
            } catch (IOException e) {
                System.out.println("Error downloading script");
                e.printStackTrace();
            }
        }

    });
    btnRunScript.setBounds(78, 279, 111, 23);
    contentPane.add(btnRunScript);

}
</code></pre>

<p>As you see here, this is my class for the loader. What I am trying to do is:</p>

<ul>
<li><p>The GUI executes itself first, it loads the scripts through method loadScripts.</p></li>
<li><p>Method loadScripts(param), executes itself three times (loadScripts(0), loadScripts(1) and loadScripts(2). </p></li>
<li>Then it will load the loadScripts in a JList.</li>
<li>Now what I want, I need to make a method with the actionlistener... That it will generate a specific URL when having any of these JList selected. When clicking run, it will download, unzip, load the classes and execute it.</li>
</ul>

<p>I have been trying this on my own, and I could not do it without any help. </p>
