title: "Error: Main method not found in class MyClass, please define the main method as..."
body: <p>New Java programmers often encounter messages like the following when they attempt to run a Java program.  (Different Java tools, IDEs and so on give a variety of diagnostics for this problem.)</p>
  <hr />
  <pre class="lang-none prettyprint-override"><code>Error: Main method not found in class MyClass, please define the main method as:
     public static void main(String[] args)
  or a JavaFX application class must extend javafx.application.Application
  </code></pre>
  <hr />
  <pre class="lang-none prettyprint-override"><code>Error: Main method not found in the file, please define the main method as: 
     public static void main(String[] args)
  </code></pre>
  <hr />
  <pre class="lang-none prettyprint-override"><code>Error: Main method is not static in class MyClass, please define the main method as:
     public static void main(String[] args)
  </code></pre>
  <hr />
  <pre class="lang-none prettyprint-override"><code>Error: Main method must return a value of type void in class MyClass, please
  define the main method as:
     public static void main(String[] args)
  </code></pre>
  <hr />
  <pre class="lang-none prettyprint-override"><code>java.lang.NoSuchMethodError: main
  Exception in thread &quot;main&quot;
  </code></pre>
  <hr />
  <p>What does this mean, what can cause it, and what should one do to fix it?</p>