This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
Why don't you post what have you got so far and we can help you figure out the rest?
Also look at this link:
http://faq.javaranch.com/java/TellTheDetails Also Googling will returns plenty of example for this particular problem .