Getting compilation timestamp of a java class

北城余情 提交于 2019-12-01 17:35:55

问题


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:


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.



来源:https://stackoverflow.com/questions/3003870/getting-compilation-timestamp-of-a-java-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!