Check out the class that is in the JAR. For instance:
Class clazz = SomeClass.class;
URL resource = clazz.getResource(clazz.getSimpleName()+".class");
JarFile jarFile = ((JarURLConnection)resource.openConnection()).getJarFile();
I know you need a JarInputStream, but I would argue that the JarFile does what you want.
source
share