              $select= intval($arg['position']);
              $short= NULL;
            } else if (isset($arg['name'])) {
-@@ -293,13 +317,6 @@
+@@ -293,13 +355,6 @@
              self::$err->writeLine('*** Error for argument '.$name.': '.$e->getMessage());
              return 2;
            }

-      } catch (ClassNotFoundException $e) {
-        self::$err->writeLine('*** ', $e->getMessage());
-        return 1;
-      }
 
       // Usage
       if ($classparams->exists('help', '?')) {
@@ -255,13 +279,13 @@
           try {
             $method->invoke($instance, array($pass));
           } catch (Throwable $e) {

 
         if (0 == $method->numArguments()) {
           $optional= TRUE;
@@ -123,8 +124,39 @@
      * @return  int
      */
     public static function main(array $args) {
-      $params= new ParamString($args);
-      
+      return create(new self())->run(new ParamString($args));
+    }
+    
+    /**
+     * Reassigns standard output stream
+     *
+     * @param   io.streams.OutputStream out
+     * @return  io.streams.OutputStream the given output stream
+     */
+    public function setOut(OutputStream $out) {
+      self::$out= new StringWriter($out);
+      return $out;
+    }
+
+    /**
+     * Reassigns standard error stream
+     *
+     * @param   io.streams.OutputStream error
+     * @return  io.streams.OutputStream the given output stream
+     */
+    public function setErr(OutputStream $err) {
+      self::$err= new StringWriter($err);
+      return $err;
+    }
+    
+    /**
+     * Main method
+     *
+     * @param   util.cmd.ParamString params
+     * @return  int
+     */
+    public function run(ParamString $params) {
+
       // No arguments given - show our own usage
       if ($params->count <= 1) {
         self::$err->writeLine(self::textOf(XPClass::forName(xp::nameOf(__CLASS__))->getComment()));
@@ -178,12 +210,42 @@
       if (!$classname) {
         self::$err->writeLine('*** Missing classname');
         return 1;
+      } else if (strstr($classname, xp::CLASS_FILE_EXT)) {
+        $file= new File($classname);
+        if (!$file->exists()) {
+          self::$err->writeLine('*** Cannot load class from non-existant file ', $classname);
+          return 1;
+        }
+        $uri= $file->getURI();
