Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Exception in thread "Main Thread" java.lang.NoSuchMethodError: main

Hi,
I have the following piece of code :

public class ServiceLoader {
	
public static void main(String[] args) {
	System.out.println("hello");
}
	

}

Open in new window


When i run it inside eclipse Indigo it gives the following error :
Exception in thread "Main Thread" java.lang.NoSuchMethodError: main

Although main is defined correctly in it still its showing the same error.
What could be the reason for this.
Avatar of dpearson
dpearson

If memory serves for Eclipse you need to tell it the name of the main class in the run configuration - perhaps it is set to a different class than ServiceLoader?
ASKER CERTIFIED SOLUTION
Avatar of Rohit Bajaj
Rohit Bajaj
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rohit Bajaj

ASKER

I solved it myself. None else commented expect one.