Can someone please tell me a reliable way to get the last modification time of a Java resource? The resource can be a file or an entry in a JAR.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you with “resource” mean something reachable through Class#getResource or ClassLoader#getResource, you can get the last modified time stamp through the URLConnection:
Be aware that getLastModified() returns 0 if last modified is unknown, which unfortunately is impossible to distinguish from a real timestamp reading “January 1st, 1970, 0:00 UTC”.