Getting compilation timestamp of a java class

前端 未结 1 1802
-上瘾入骨i
-上瘾入骨i 2021-01-18 20:39

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条回答
  • 2021-01-18 21:12

    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.

    0 讨论(0)
提交回复
热议问题