Re: Compile Date



Roedy Green wrote:
Is the compile date of a class embedded in the class file somewhere? I
could see not putting it in to avoid false deltas when the code did
not really change.

The JVM Specification's description of the class file format doesn't
mention such a thing. However, a Java (or other) compiler can define
attributes beyond those mentioned in the JVMS, and a timestamp attribute
could be among the extras added. The JVM ignores attributes other than
the JVMS' set, so (1) such a timestamp wouldn't hurt anything, and (2)
its value would not be visible from inside the JVM after the class was
loaded.

It there a method to find out when a class was most recently compiled?

I suppose it could be handled with a script that generates a little
class containing today's date that gets freshly recompiled each day,
but that really just tells you when the jar was built.

You could hack javac to emit a "com.mindprod.CompileTime" attribute,
presumably as an attribute of the class itself (attributes also attach
to methods, fields, and so on). Or you could write a little utility to
add it to an already-compiled .class file -- but that really just tells
you when the utility was run, not when javac ran, so you'd need to be
diligent with your build scripts.

--
Eric.Sosman@xxxxxxx
.



Relevant Pages

  • Re: Database applications in Linux
    ... > Ben Hutchings pulled a bright blue crayon out of the box and scribbled ... >> This was true for some early JVMs and is true for the very small JVMs ... The "java" executable compiles the byte-code to machine code as ... (e.g. Java classes and Win32 executables) ...
    (comp.os.linux.development.apps)
  • Re: Generics - the path not taken
    ... Erasure would make sense if Java 1.5 code had to run of earlier JVMs, ... ``Extending the virtual machine instruction set to support generics was ...
    (comp.lang.java.programmer)
  • Re: Java slow ?
    ... > what could be the causes of the slowness of Java. ... designed for special purposes where speed is less important than something else ... Papers on optimisations used in JVMs that discuss ...
    (comp.lang.java.programmer)
  • Re: Determining the JVM Threading Model used on Windows
    ... i.e. 1 OS-thread for each Java thread. ... Other vendors' JVMs will probably be different (I'm pretty sure the BEA ... "JRockit" JVM has green threads even on Windows). ... I don't know of any defined way to find out how Java threads are mapped to OS ...
    (comp.lang.java.programmer)
  • Re: how to improve TCP thoughput in Java app
    ... Could anyone share their stories of improving TCP thoughput in Java ... between different jvms. ... input/output stream buffer time, ...
    (comp.lang.java.programmer)