title: Scanning classpath/modulepath in runtime in Java 9
body: <p>I can't seem to find any info on whether scanning all available classes (for interfaces, annotations etc) is still possible in runtime, the way Spring, Reflections and many other frameworks and libraries currently do, in the face of Jigsaw related changes to the way classes are loaded.</p>
  
  <p><strong><em>EDIT</em></strong>: 
  This question is about <em>scanning</em> the real physical file paths looking for classes. <a href="https://stackoverflow.com/questions/45166757/loading-classes-and-resources-in-java-9">The other question</a> is about dynamically <em>loading</em> classes and resources. It's related but very much <strong>not a duplicate</strong>.</p>
  
  <p><strong><em>UPDATE</em></strong>: Jetty project has made a <a href="https://github.com/jetty-project/annotation-discovery" rel="noreferrer">JEP proposal</a> for a standardized API for this. If you have a way to help make this reality, please do. Otherwise, wait and hope.</p>
  
  <p><strong><em>UPDATE 2</em></strong>: Found <a href="http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-September/013182.html" rel="noreferrer">this</a> relevant sounding post. Quoting the code snippet for posterity:</p>
  
  <blockquote>
    <p>If you are really just looking to get at the contents of the modules in
    the boot layer (the modules that are resolved at startup) then you'll do
    something like this:</p>
  </blockquote>
  
  <pre><code>  ModuleLayer.boot().configuration().modules().stream()
           .map(ResolvedModule::reference)
           .forEach(mref -&gt; {
               System.out.println(mref.descriptor().name());
               try (ModuleReader reader = mref.open()) {
                   reader.list().forEach(System.out::println);
              } catch (IOException ioe) {
                   throw new UncheckedIOException(ioe);
               }
           });
  </code></pre>