public static void main(String[] args)
    {
        final float heapSizeMegs = Runtime.getRuntime().maxMemory() / 1024L / 1024L;
        boolean start = false;
        if (heapSizeMegs > MIN_HEAP || !start)
        {
            start = true;
        }
        else
        {
            try
            {
                final String pathToJar = MCLauncher.class.getProtectionDomain()
                        .getCodeSource().getLocation().toURI().getPath();
                
                final ArrayList<String> params = new ArrayList<String>();
                
                params.add("javaw");
                params.add("-Xmx" + Long.toString(RECOMMENDED_HEAP) + "m");
                params.add("-Dsun.java2d.noddraw=true");
                params.add("-Dsun.java2d.d3d=false");
                params.add("-Dsun.java2d.opengl=false");
                params.add("-Dsun.java2d.pmoffscreen=false");
                
                params.add("-classpath");
                params.add(pathToJar);
                params.add("com.kokakiwi.mclauncher.MCLauncher");
                final ProcessBuilder pb = new ProcessBuilder(params);
                final Process process = pb.start();
                if (process == null)
                {
                    throw new Exception("!");
                }
                System.exit(0);
            }
            catch (final Exception e)
            {
                e.printStackTrace();
                start = true;
            }
        }
        
        if (start)
        {
            final MCLauncher main = new MCLauncher(args);
            main.start();
        }
    }