0

Every time I try to run a program,

Error: Main method not found in class program3, please define the main method as:

public static void main(String[] args)

An example would be:

public class program3 {
public static void main(String[] args) {
    System.out.println("Hello World");
}
}

Any help is appreciated, thanks in advance.

Ashish
  • 735
  • 1
  • 6
  • 15
Applesire Jon
  • 11
  • 1
  • 1
  • 4
  • Welcome to Stack Overflow! It's not clear to me what you're asking -- perhaps you can provide some more context, or an example showing what you're looking for? Be sure also to check the [question checklist](http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist). Thanks! – Christian Ternus Nov 01 '13 at 05:56
  • Refer this page http://stackoverflow.com/questions/11235827/eclipse-error-could-not-find-or-load-main-class – Puvanarajan Nov 03 '13 at 02:39

2 Answers2

1

Select the particular file and right click. Now you can see the run option. try this

Puvanarajan
  • 2,786
  • 6
  • 26
  • 37
0

make sure that you are compiling the class. if you had not compiled the code and trying to execute an old version that was compiled before you inserted main might be causing the issue.

Thirumalai Parthasarathi
  • 4,541
  • 1
  • 25
  • 43