title: Load specific class of jar folder
body: <p>I have a server who scan a folder containing some jars, and for each jar get class who is subclass of AbstractPlugin class.</p>
  
  <p>I use this jar to help me : <a href="https://code.google.com/p/reflections" rel="nofollow">https://code.google.com/p/reflections</a>
  But when I migrate from</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.reflections&lt;/groupId&gt;
          &lt;artifactId&gt;reflections&lt;/artifactId&gt;
          &lt;version&gt;0.9.9-RC1&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>to :</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.reflections&lt;/groupId&gt;
          &lt;artifactId&gt;reflections&lt;/artifactId&gt;
          &lt;version&gt;0.9.10&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>This code doesn't work anymore :</p>
  
  <pre><code>        File pluginFolder = new File(PROP.getString("plugin.folder", "./plugins/"));
  
          for (File file : pluginFolder.listFiles()) {
              if (file.getName().endsWith(".jar")) {
                  List&lt;URL&gt; jarsUrl = new ArrayList&lt;&gt;();
                  URL jarUrl = file.toURL();
                  jarsUrl.add(jarUrl);
  
                  ClassLoader loader = URLClassLoader.newInstance(
                      jarsUrl.toArray(new URL[] {}), 
                      getClass().getClassLoader()
                  );
  
                  Reflections reflections = new Reflections(
                      ClasspathHelper.forClassLoader(loader),
                      new SubTypesScanner()
                  );
  
                  Store store = reflections.getStore();
                  Set&lt;String&gt; pluginClass = store.getSubTypesOf(AbstractPlugin.class.getName());
              }
          }
  </code></pre>
  
  <p>Before migrate pluginClass respond me with all class who herited from AbstractPlugin in the jar of "plugins" folder.</p>
  
  <p>So I try with a new code to do the same thing :</p>
  
  <pre><code>        File pluginFolder = new File(PROP.getString("plugin.folder", "./plugins/"));
  
          Arrays.asList(pluginFolder.listFiles())
              .stream()
              .filter(file -&gt; file.getName().endsWith(".jar"))
              .forEach((file) -&gt; {
                  try {
                      System.out.println(file.getName());
  
                      Reflections reflections = new Reflections(
                          new ConfigurationBuilder()
                              .addUrls(file.toURI().toURL())
                              .addScanners(new SubTypesScanner(false))
                      );
  
                      System.out.println(reflections.getAllTypes());
  
                  } catch (Exception e) {
                      LOG.error(e.getMessage(), e);
                  }
              });
  </code></pre>
  
  <p>It doesn't work too. Someone can help me to fix this and get allsubtype of AbstractPlugin class for each jar in a folder?</p>
  
  <p>Thank you by advance :-)</p>