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.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact