private static Configuration readArgs(final String[] args) throws IOException
    {

        Configuration config = null;
        String url = null; // you can set the destination as -site    
        String file = null;  // name of the properties file

        for (int i = 0; i < args.length; i++)
        {
            if (args[i].equalsIgnoreCase("+gui")) //$NON-NLS-1$
            {
                startGUI = true;
            }
            else if (args[i].equalsIgnoreCase("-gui")) //$NON-NLS-1$
            {
                startGUI = false;
            }
            else if (args[i].equalsIgnoreCase("-debug")) //$NON-NLS-1$
            {
                debug = true;
            }
            else if (args[i].equalsIgnoreCase("-site")) //$NON-NLS-1$
            {
                i++;
                url = args[i];
            }
            else
            {
                file = args[i];
            }
        } // Endfor

        if (file == null)
        {
            // no properties file supplied, so return a default config
            // plus anything in the Web Start muffins cache:
            config = new Configuration();
            config.loadMuffins();
        }
        else
        {
            Properties props = new Properties();
            FileInputStream in = new FileInputStream(file);
            try
            {
                props.load(in);
            }
            finally
            {
                in.close();
            }
            config = new Configuration(props);
        }


        if (url != null)
        {
            config.setDestination(new URL(url));
        }


        return config;

    }