-4

I have a Project in Bus Ticker Reservation. and I have also Source code but when run into eclipse got an error "Selection does not contain a main file" please help me I am new in Programming

screenshot attached

Problem Screenshot

m_callens
  • 6,100
  • 8
  • 32
  • 54
  • 1
    Open a file which contains a `public static void main(String[])` Method and then click besides the green run button on the top, and open the drop down menu. From there move to "Run as.." and then Java – Japu_D_Cret Mar 25 '17 at 22:10
  • there is no such file which contains public static void main(String[]) this method – Munawar Gujjar Mar 25 '17 at 22:18
  • Well than you can't run it, because without a starting point it cannot start... you can create the method in any class of your choice and use the other classes inside it – Japu_D_Cret Mar 25 '17 at 22:20
  • You should probably learn how to run "Hello World" before moving to methods and classes – Chris Sharp Mar 25 '17 at 22:27
  • this is source code I just want to run after that i can learn everything – Munawar Gujjar Mar 25 '17 at 22:30
  • To be fair, he can't run "Hello World" without a main method... – D M Mar 25 '17 at 22:44

2 Answers2

1

The class to be executed needs a method with the following signature: public static void main(String[] args).

ldz
  • 2,217
  • 16
  • 21
0

You need to create a main method. When you execute a class, the runtime system starts by calling the class's main() method, so without it your class will not get executed.

So you need to add the following code to the class you are trying to run:

public static void main(String[] args){
     ClassName c = new ClassName();
}
pogba123
  • 79
  • 1
  • 3
  • 9