debug("jgachine uri");
debug("jgachine uri => connect to server");
    static public void main(String args[]) {	if (runCalled) return;	runCalled=true;	if ((args==null)||(args.length<1))	    {		System.out.println("Usage: Client uri arg1 arg2 ...");		System.out.println("Where uri is simply a class name for local games (f.e. tutorial.pong1.Pong)");		System.out.println("and jgachine://servername:port/tutorial.pong1.Pong for remote games");		return;	    }	// libgcj does not implement the uri yet (URL seems a bit strange...)	// URI uri = new URIargs[0]);	String uri = args[0];	int p=uri.indexOf("://");	if (p<=0) {	    // run local game - without network	    resourceLoader = new LocalResourceLoader();	    JGachine.init();	    try {		Class c=Class.forName(uri);		System.setSecurityManager(new MySecurityManager());		debug("installed security manager");		Object obj=c.newInstance();		debug("calling fetched code");		((Runnable)obj).run();	    }catch(Exception e){		e.printStackTrace();	    }	    JGachine.deinit();	    return;	}else{	    String scheme = uri.substring(0,p);	    if (scheme.equals("jgachine")) {		debug("jgachine uri");		// this is written that stupid to show whats going on		String spr = uri.substring(p+"://".length());		debug("spr: "+spr);		String sp = spr.substring(0,spr.indexOf("/"));		debug("sp: "+sp);		String server = sp.substring(0,sp.indexOf(":"));		debug("server: "+server);		int port = new Integer(sp.substring(sp.indexOf(":")+":".length())).intValue();		debug("port: "+port);		String gameclass = spr.substring(spr.indexOf("/")+"/".length());		debug("gameclass: "+gameclass);		if (port<0) port=34444; // todo default port				resourceLoader = new NetResourceLoader();		JGachine.init();		    		try {		    socket = new Socket(InetAddress.getByName(server),port);					    // order is important !!		    objOut = new ObjectOutputStream(socket.getOutputStream());		    objIn = new ObjectInputStream(socket.getInputStream());					    MyClassLoader loader=new MyClassLoader();		    Class c=loader.loadClass(gameclass);		    System.setSecurityManager(new MySecurityManager());		    debug("installed security manager");		    Object obj=c.newInstance();		    debug("calling fetched code");		    ((Runnable)obj).run();					    socket.close();		}catch(Exception e){		    e.printStackTrace();		}		    		JGachine.deinit();	    }else{		System.out.println("Unsupported URI scheme");		return;	    }	}    }