Please read the forum rules. Double posting is not allowed (your duplicate post has been removed), and please wrap your code in the code tags.
error: unreported exception Exception; must be caught or declared to be thrown
The error pretty much says it all. The code throws an Exception, which you must catch or declare thrown so that it may be caught. Surround your code with a try/catch/finally, or have your method throw the appropriate Exception. See
http://docs.oracle.com/javase/tutori...al/exceptions/