I have this situation.
I have several jar files and each jar file has a separate version.
util.jar
Version.java
XMt.jar
Version.java
XSlT.jar
Version.java
All the jar files references to and uses util.jar. Instead of constantly
having to update each Version.java file
I would like to have them refer to the number that is set in util.jar. For
example
in XMt.jar
Version.java
VERSION_NUMBER = util.jar.XMt.Version.
So basically these numbers need to be written at compile time just in case a
user mixes the jar files I want to be able to know when each jar was built
and not just the current version of the util.jar.
Any solutions?
Should this work if I used public static final?
Christian Schlichtherle - 15 Jun 2005 01:09 GMT
Nope, that won't work. You're just referring to another reference to a
memory location.
Try using a version control system and let it substitute a literal for you
in each Version.java instead.
Regards,
Christian
Wibble - 15 Jun 2005 02:56 GMT
> I have this situation.
> I have several jar files and each jar file has a separate version.
[quoted text clipped - 22 lines]
> Any solutions?
> Should this work if I used public static final?
Instead of creating:
class Util { public final static int VERSION=1.2; }
use:
class Util { public final static int VERSION_1_2 = 0; }
and refer to the named symbol, not the value to ensure that the jars are
compatible.