This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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"
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.