How to get lastModified time of a file within a jar file on the classpath?

Jens Dibbern

If you know the jar file, you can open it as a java.util.jar.JarFile object and use getJarEntry to retrieve the file in question as a java.util.jar.JarEntry object. After that you can call getTime.
If you do not know the jar file, you have to get the classpath by String classPath = System.getProperty("java.class.path"); and try every jar file included.
Sorry about the last bit - I know it looks quite clumsy.

About | Sitemap | Contact