code: private static FileMonitor createFileMonitor(String [] args)
     throws Exception
     {
          String usage= " Usage: [-pollingInterval <timems>]? [-observer <class>]* [-monitor <dir>:<filter>:<ignoreCurrentContentBoolean>]*";
  
        if(args == null || args.length < 2 )
           throw new IllegalArgumentException(usage);
        
        FileMonitor fileMonitor =new FileMonitor();
        
        String [] arrayString = null;
        SubjectObserver<FileEvent> observer = null;
        for(int i=0; i < args.length;i++)
        {
           if("-monitor".equals(args[i]))
           {
              if(i+1 >= args.length)
              {
                 throw new IllegalArgumentException("directory:filter specified -monitor argument "+usage);
              }
              
              arrayString = args[i+1].split(":");
              if(arrayString.length != 3)
                 throw new IllegalArgumentException(args[i+1]+usage );
              
              fileMonitor.monitor(arrayString[0],arrayString[1],Boolean.valueOf(arrayString[2]).booleanValue());
  
              i = i+1;
           }
           else if("-pollingInterval".equals(args[i]))
           {
              if(i+1 >= args.length)
              {
                 throw new IllegalArgumentException("no time specified -pollingInterval argument "+usage);
              }
              
              fileMonitor.setPollingInterval(Long.parseLong(args[i+1]));
              i = i+1;
           }
           else if("-observer".equals(args[i]))
           {
              if(i+1 >= args.length)
              {
                 throw new IllegalArgumentException("no observer specific in -observer argument "+usage);
              }
                 
              //fileMonitor.addObserver((Observer)Class.forName(args[i+1]).newInstance());
              observer = ClassPath.newInstance(args[i+1]);
              fileMonitor.add(observer);
              i = i+1;
           }
         }//end for
        return fileMonitor;
     }
docs: -------------------------------------------