tags:

views:

69

answers:

2

In Eclipse, when you create a new class, you can select the option "Which methods stubs would like to create:" and you can choose " public static void main(String args[])".

I have created a class with a main method, but I haven't checked that option and I receive this error: "selection does not contain a main type in eclipse". How can I show Eclipse that I have a main method in the class, without deleting/recreating the class file?

Later Edit: :) My mistake: My main method looks like this: public static void main(String args) and because of this, I received the error message.

+1  A: 

I suspect that the signature of your method is wrong. It has to be exactly:

public static void main(String[])

otherwise it won't work. Naming the method Main will fail, omitting the argument to the method will fail. Also, I think the class needs to be public.

Joey
hahahahahaThe method looks like this: public static void main(String args)
cc
A: 

Are you sure that you have a method of the type
public static void main(String[] args) ?

You should check if you have no typos in your code. Maybe you could post an example of your main-method's head.

Ham