I am trying to detect which class inside a jar contains main or a supplied method name (if possible).
At the moment I have the following code
public static void getFromJars(String pathToAppJar) throws IOException{
FileInputStream jar = new FileInputStream(pathToAppJar);
ZipInputStream zipSteam = new ZipInputStream(jar);
ZipEntry ze;
while ((ze = zipSteam.getNextEntry()) != null) {
System.out.println(ze.toString());
}
zipSteam.close();
}
This will allow me to get packages and classes under these packages, but I do not know if it is possible to even get methods inside classes. Further, I do not know if this approach is even good for a case of several pkgs inside the jar, since each package can have a class with main in it.
I would appreciate any ideas.