I'd like to print the time of compilation of a class.
class Test {
public Test() {
System.out.println("Compiled:" + getCompilationTimestamp());
}
}
Is this possible?
Looking at the class file format, I don't believe that information is stored anywhere - so the answer would be "no".
If you're building your classes into a jar file, you might want to include a metadata file which specifies this information. (I don't think there's anything suitable in the manifest file format, but I could be wrong.)
See more on this question at Stackoverflow