code: public void runScript(String configFileName) 
  	{
  		int lineNum = 0;
  		try {
  	    BufferedReader in = new BufferedReader(new FileReader(configFileName));
  	    String line;
  	    while ((line = in.readLine())!=null) {
  				lineNum++;
  				if (!line.startsWith("#")) {
  					String command = null;
  					List args = new ArrayList();
  					StringTokenizer tok = new StringTokenizer(line);
  					if (tok.hasMoreTokens()) {
  						command = tok.nextToken();
  					}
  					while (tok.hasMoreTokens()) {
  						args.add( tok.nextToken() );
  					}
  					if (command!=null) {
  						if (echoCommands) System.out.println("exec: "+line);
  						execCommand(command,args);
  					}
  				}
  			}
  		} catch (Exception e) {
  			System.out.println("Error: "+configFileName+" line "+lineNum+": "+e.toString());
  			e.printStackTrace();
  			return;
  		}
  	}
docs: Load commands from a file and execute them.