[java] Why do I get "Exception; must be caught or declared to be thrown" when I try to compile my Java code?