title: JAVA - get class from file.java located on disk
body: <p>I want to load class definition or fields from file.java located on disk.
  I tried URLClassLoader:</p>
  
  <pre><code>        URL url = file.toURL();
          URL[] urls = new URL[]{url};
          ClassLoader cl = new URLClassLoader(urls);
          Class c = new Object().getClass();
          try {
              c = cl.loadClass(className);
          } catch (ClassNotFoundException e1) {
                System.err.println("not found class: " + className);
          }
  </code></pre>
  
  <p>But it doesnt work ;(</p>