Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

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

0
Posted

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

0

Location: http://www.jguru.com/faq/view.jsp?EID=773187 Created: Feb 26, 2002 Author: Jens Dibbern (http://www.jguru.com/guru/viewbio.jsp?EID=9896) Question originally posed by Alan Gault (http://www.jguru.com/guru/viewbio.jsp?EID=131380 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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123