0 Replies Latest reply: Jul 13, 2008 8:58 AM by 843810 RSS

    How to test that the file contains main method ?

    843810
      Hi,
      How can I test that the java file I want to trace doesn't containa main method? I tried to figure out what exception can I have, but couldn't figure it out. What I mean is when I trace java file that doesn't have main method I got the following exception? Where can I catch it?
      Thanks

      Ex: I can trace this file because it contains main
      class Foo {
          int a = 0, b = 1, c = 2;
         
       
          public static void main(String[] args) {
           int e = 4;
           int g = 5;
           Foo f = new Foo();
           for(int i=0; i<2; i++)
               f.foo();
          } 
          public static void foo() {
           int d = 3;
           System.out.println("Foo");
           d = 4;
          }
         
      }
      but can not trace this one
      class Foo {
          int a = 0, b = 1, c = 2;
         
          }