title: Exception in thread "main" java.lang.NoSuchMethodError: main
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2496073/exception-in-thread-main-java-lang-nosuchmethoderror-main">Exception in thread &ldquo;main&rdquo; java.lang.NoSuchMethodError: main</a>  </p>
  </blockquote>
  
  
  
  <p>I got the above message. The code is as follows:</p>
  
  <pre><code>class Test
  {
   public static void main(String ar[])
   {
    printf("hai");
   }
  }
  </code></pre>
  
  <p>How is this problem caused and how can I fix it?</p>