PLEASE use an IDE for development. The IDE would tell you right away that you did miss to import the class
Exception
.
Eclipse[
^]
Netbeans[
^] (java SE Version is perfectly fine)
Both are free, both will guide you through the process of developing.
Nobody is developing by foot any more. There is no reason for not using the given tools.