This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Exception Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception Question" Watch "Exception Question" New topic

Exception Question

Linze marin

Joined: Jul 23, 2004
Posts: 12
I have rec'd the following run time error msg.

Can anyone please give me some insight as to what it means?


Exception in thread "main" java.lang.NoSuchMethodError: main
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

It means that the class you specified at the command line was found, but doesn't contain a method with the signature

public static void main(String[] args)

Check your code, make needed changes, and recompile. Every aspect of this line (except the name "args", which is arbitary, and the qualified "public" which some Java implementations don't care about) is necessary, and changing any of them would lead to the error message you described.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Exception Question
It's not a secret anymore!