protected static Class tryLoadMainClass(String jarFileName, String fileClassName) throws Exception {
    try {
      JarClassLoader loader;
      try {
        loader = new JarClassLoader(new URL("file:///" + jarFileName));
      }
      catch (MalformedURLException exc) {
        throw new Exception("MalformedURLException: " + exc.getMessage());
      }

      String className = fileClassName;
      String mainClassName = loader.getMainClassName();
      //..
      int pos = className.indexOf(".");
      if (pos != -1) {
        className = className.substring(0, pos);
      }
      else {
        throw new Exception("Incorrect fullname class file (must be ex: packagename/classname.class)");
      }
      //..
      className = className.replace("/", ".");
      //..
      Class clss = null;
      if (className.equalsIgnoreCase(mainClassName))
        clss = loader.loadClass(mainClassName);

      return clss;
    }
    catch (Exception exc) {
      throw new Exception("loadMainClass: " + exc.getMessage());
    }
  }