Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting compilation timestamp of a java class

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 ?

like image 362
Alex Kravets Avatar asked Oct 25 '22 13:10

Alex Kravets


1 Answers

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.

like image 86
maerics Avatar answered Nov 08 '22 09:11

maerics