On May 14, 6:59 am, "* ^ *" <[email protected]> wrote:
> I cannot seem to propagate the throws clause up the calling method.
> Why?
>
> The relevant code fragments are as below:
> class WorldCupCountries{
>     public WorldCupCountries() throws URISyntaxException{
>         doSelectionNDisplay();
>     }
>     private void doSelectionNDisplay() throws URISyntaxException{
>         URL dirURL=getClass().getResource(path);
>         File dir=new File(dirURL.toURI());
>     }
>
> }
>
> public class Main {
>     public static void main(String[] args) throws URISyntaxException{
>         SwingUtilities.invokeLater(new Runnable(){
>             public void run() {
> // Next line is the source of the error.
>                 new WorldCupCountries();
>             }
>         });
>     }
>
> }
>
> Exception thrown: Exception in thread "AWT-EventQueue-0"
> java.lang.RuntimeException: Uncompilable source code - unreported
> exception java.net.URISyntaxException; must be caught or declared to
> be thrown.
> But I have declared it should be thrown by main(). All input is
> greatly appreciated. Thank you.
You have thrown it, but you never have caught it. That's why finally
it is the java runtime machine which throws it.
See here the graphics, very explicitly (don't bother the text, it is
in French).

http://www.commentcamarche.net/contents/java/javaexc.php3
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to