title: Is it possible to read class files from a jarfiles from a certain path
body: <p>So I am fairly new to java but what I am trying to achieve is I have a list containing jar files that are in a certain directory and I want to be able to read the class files inside those jars and then globally search a string that would be inside a class file.</p>
  
  <p>My current code:</p>
  
  <pre><code>public class Dank 
  {
  
      public static void main(String[] args) 
      {
          List&lt;File&gt; jarFiles = new ArrayList&lt;&gt;();
          File[] mods = new File(System.getProperty("user.home") + "\\AppData\\Roaming\\.minecraft\\mods").listFiles();
  
  
          for(File file : mods)
          {
              if(file.isFile())
              {
                  String filename = file.getName();
                  if(filename.endsWith(".jar")) {
                      jarFiles.add(file);
                  //  System.out.println(filename);
                  }
              }
          }
  
      }
  }
  </code></pre>