import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Collections;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Pattern;

public class JGlasses {
    /*
      Fix URLClassLoader protected method
    */
    static class FixedURLClassLoader extends URLClassLoader {
        public FixedURLClassLoader(URL[] urls) { super(urls); }
        public Class<?> findClass(String name) throws ClassNotFoundException { return super.findClass(name); }
    }
    /*
        Remove extra quotes if in windows, and they are present.
    */ 
    public static String fix_wildcard(String in) {
        if (System.getProperty("os.name").toLowerCase().indexOf("win") < 0) {
            return in;
        }
        if (in.charAt(0) == '\'' && in.charAt(in.length()-1) == '\'' || 
            in.charAt(0) == '"' && in.charAt(in.length()-1) == '"') {
            return in.substring(1, in.length()-1);
        }
        return in;
    }

    public static void main(String[] args) throws IOException {
        if (args.length < 2) {
            System.err.println("Usage: java JGlasses <class regex> <method regex> [<jar filename> ...]");
            System.err.println("Note: on windows regexen will need to be double quoted: \"'.*'\" for .*,");
            System.err.println(" to avoid their damn wildcard expansion that can't be avoided.");
            System.err.println(" Microsoft and Oracle hate us.");
            return;
        }

        Pattern class_regex = Pattern.compile(fix_wildcard(args[0]));
        Pattern method_regex = Pattern.compile(fix_wildcard(args[1]));
        String[] jar_names = Arrays.copyOfRange(args, 2, args.length); 

        URL[] urls = new URL[args.length];
        for (int i = 0; i < jar_names.length; i++) {
            urls[i] = new File(jar_names[i]).toURI().toURL();
        }
        FixedURLClassLoader loader = new FixedURLClassLoader(urls);
        
        for (String jar_name : jar_names) {
            JarFile jar = new JarFile(jar_name);
            for (JarEntry entry : Collections.list(jar.entries())) {
                String file = entry.getName();

                if (file.endsWith(".class")) {
                    String classname = file.replace('/', '.').substring(0, file.length() - 6);

                    if (class_regex.matcher(classname).find()) { 
                        try {
                            Class<?> c = loader.findClass(classname);
                            for (Method m : c.getDeclaredMethods()) {
                                String method_string = m.toString();
                                if (method_regex.matcher(method_string).find()) { 
                                    System.out.println(method_string);
                                }
                            }
                        } catch (Throwable e) {
                            System.err.println(classname + " not found.");
                        }
                    }
                }
            }
        }
    }
}

@@ -596,24 +596,25 @@
 e); %7D%0A    %7D%0A
+%0A
     /*%0A     
@@ -1069,24 +1069,692 @@
  in;%0A    %7D%0A%0A
+    static Pattern class_regex;%0A    static Pattern method_regex;%0A%0A    public static void print_methods(String classname) %7B%0A        if (class_regex.matcher(classname).find()) %7B %0A            try %7B%0A                Class%3C?%3E c = loader.findClass(classname);%0A                for (Method m : c.getDeclaredMethods()) %7B%0A                    String method_string = m.toString();%0A                    if (method_regex.matcher(method_string).find()) %7B %0A                        System.out.println(method_string);%0A                    %7D%0A                %7D%0A            %7D catch (Throwable e) %7B%0A                System.err.println(classname + %22 not found.%22);%0A            %7D%0A        %7D%0A    %7D%0A%0A
     public s
@@ -2253,24 +2253,16 @@
         
-Pattern 
 class_re
@@ -2315,24 +2315,16 @@
         
-Pattern 
 method_r
@@ -2387,24 +2387,25 @@
 tring%5B%5D 
-jar_name
+classpath
 s = Arra
@@ -2571,24 +2571,25 @@
 ew File(
-jar_name
+classpath
 s%5Bi%5D).to
@@ -2714,32 +2714,74 @@
 ing 
-jar_name : jar_names) %7B%0A
+path : classpaths) %7B%0A            if (path.endsWith(%22.jar%22)) %7B%0A    
     
@@ -2833,24 +2833,28 @@
             
+ 
+   
 for (JarEntr
@@ -2910,24 +2910,28 @@
             
+    
 String file 
@@ -2949,17 +2949,19 @@
 Name();%0A
-%0A
+   
         
@@ -2964,24 +2964,25 @@
             
+ 
 if (file.end
@@ -2996,24 +2996,28 @@
 .class%22)) %7B%0A
+    
             
@@ -3103,680 +3103,58 @@
 6);%0A
-%0A                    if (class_regex.matcher(classname).find()) %7B %0A                        try %7B%0A                            Class%3C?%3E c = loader.findClass(classname);%0A                            for (Method m : c.getDeclaredMethods()) %7B%0A                                String method_string = m.toString();%0A                                if (method_regex.matcher(method_string).find()) %7B %0A                                    System.out.println(method_string);%0A                                %7D%0A                            %7D%0A                        %7D catch (Throwable e) %7B%0A                            System.err.println(classname + %22 not found.%22);%0A                        %7D
+                        print_methods(classname); 
 %0A   

Refactor and check for .jar ending