Hi All Is there any way to store compile time data in Java? For example I want to compile one class which displays today's date and time. I am using Calender class to do this. And This today's date is displayed in About box of my application. But what is happening is if I open my application 4 days from now it displays the date current on that day and not today's date when I compiled my application. I know all objects are created at runtime in Java. But was interested does any one knows a trick on how to do this. Thanks Avinash.
Blake Minghelli
Ranch Hand
Joined: Sep 13, 2002
Posts: 331
posted
0
Well, just a thought off the top of my head... there's probably a better way of doing it... Your build process could include the execution of a java program that generates another java class that stores the compile time date. For example, the program would use a PrintWriter to actually write a java source file that contains a static constant that is initialized with the current date. Like this:
Your build routine can compile the new HelpInfo source file and include it in your release. Then, your "About" frame could get the compile date via HelpInfo.COMPILE_DATE. Good luck! [ October 16, 2002: Message edited by: Blake Minghelli ]
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Lewin Chan
Ranch Hand
Joined: Oct 10, 2001
Posts: 214
posted
0
This is a similar idea, why not have a properties file that is generated by your build process that has a timestamp in it, Then you can just use that pre-defined property as the source of your "about box"
I have no java certifications. This makes me a bad programmer. Ignore my post.