5

Is it possible to reliably determine the compilation time stamp of a given class for both java applications running locally and as applets and/or JNLP webapps ?

1

1 Answer 1

3

According to the Java Virtual Machine Specification, the Class File Format does not require a timestamp of any sort, so the best you could do is check the modification time of the Class or Jar file that contains the class. Unfortunately, filesystem operations, especially between various hosts, might not preserve such timestamps.

I would say there isn't a reliable way by default. However, you could easily embed such a timestamp in a Jar file or a Class file as part of your build process.

1
  • for reproducibility purposes, I prefer files not to contain timestamps, so that everyone building the same code gets the same output binary classfile which is all that should matter to the jvm anyways (plus the name/path of the class file...)
    – masterxilo
    Sep 22, 2023 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.