In my application I have to read a jar file available in the disk location and segregate .classes file from the jar.
Code is
JarFile jarFile = new JarFile("./resources/CD.jar"); for(Enumeration<JarEntry> em = jarFile.entries(); em.hasMoreElements();) { String s= em.nextElement().toString(); ZipEntry entry = jarFile.getEntry(s); String fileName = s.substring(s.lastIndexOf("/")+1, s.length()); if(fileName.endsWith(".class")){ System.out.println(fileName); } But I am getting an error
java.io.FileNotFoundException: .\resources\CD.jar (The system cannot find the path specified).
.jarfile only or you want to do something else? I can see that your code only displays the name