code: public static String readClassName (File source)
          throws IOException
      {
          // load up the file and determine it's package and classname
          String pkgname = null, name = null;
          BufferedReader bin = new BufferedReader(new FileReader(source));
          String line;
          while ((line = bin.readLine()) != null) {
              Matcher pm = PACKAGE_PATTERN.matcher(line);
              if (pm.find()) {
                  pkgname = pm.group(1);
              }
              Matcher nm = NAME_PATTERN.matcher(line);
              if (nm.find()) {
                  name = nm.group(2);
                  break;
              }
          }
          bin.close();
  
          // make sure we found something
          if (name == null) {
              throw new IOException("Unable to locate class or interface name in " + source + ".");
          }
  
          // prepend the package name to get a name we can Class.forName()
          if (pkgname != null) {
              name = pkgname + "." + name;
          }
  
          return name;
      }
docs: Reads in the supplied source file and locates the package and class or interface name and
  returns a fully qualified class name.