[ale] Java Make Files

Denny Chambers dchambers at snapserver.com
Thu Jun 27 10:56:55 EDT 2002


I believe the way to do versioning in java is through jar files and the 
java.lang.Package class. You must package your classes into a jar file 
first. Then through the manifest file which gets inserted in to the jar 
(Changed to the maifest would be what you would want to dynamically 
change in the code below, instead of generating a new class) you can add 
titles, vendor strings, and version numbers. The jar utility allows you 
to specify a manifest file that will be merged with the one it creates. 
I haven't done versioning before, so I don't have any sample code, but I 
think this is an approach worth looking at. You may also want to look 
into Jakarta's Ant build envronment. It is a "make" type environment 
specifically for Java. It provides a lot of prebuilt task for javac, 
java, jar, javadoc, mkdir, copy, delete, cvs, ftp ,mail. etc.......

Hope this helps,
Denny

cfowler wrote:

>I'm trying to incorporate Build Dates and Version in java code.  I can
>not use defines like I can with C so I cam up with a Solution.
>
>Is this the best way?
>
>
>
>#
># We can not use defines in Java so we
># dynamically create a class that stores
># the build date for the clock
>#
>
>version:
>        echo "public class BuildVersion {"                            >
>BuildVersion.java
>        echo "    private static String Date = \"$(BDATE)\";"        >>
>BuildVersion.java
>        echo "    private static String Version  = \"$(Version)\";"  >>
>BuildVersion.java
>        echo " "                                                     >>
>BuildVersion.java
>        echo "    public static String getVersionString() {"         >>
>BuildVersion.java
>        echo "        return Version + Date;"                        >>
>BuildVersion.java
>        echo "    }"                                                 >>
>BuildVersion.java
>        echo "}"                                                     >>
>BuildVersion.java
>
>
>
>---
>This message has been sent through the ALE general discussion list.
>See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
>sent to listmaster at ale dot org.
>
>  
>



---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list