• Post Reply Bookmark Topic Watch Topic
  • New Topic

Head First java class Party  RSS feed

 
Ivan Onishchenko
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I try to run Party.class and get error:
C:\Program Files\Java\jdk1.7.0_05\bin>java Party
Error: Main method not found in class Party, please define the main method as: public static void main(String[] args)

What maybe it?
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan, welcome to JavaRanch!

It's probably just what the message says: you don't have a main method defined exactly the way it says. It could be something very small like a capital M in main, or missing the static keyword, but it's definitely something.
 
Ivan Onishchenko
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand it, when readed next some pages.
It is strange that no this metod in example code =)
THank you!
 
La Lopez
Greenhorn
Posts: 4
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same problem as Ivan. What he's saying is that although he wrote the code as it appears on the book, he gets the "Main method not found" error. My question is the same as his: The code in the book has no Main method. How am I supposed to know you need a main method in this particular exercise (the first exercise of the book) when there isn't one written in the sample? I understand that all programs should have a main method, but in this particular example, which happens to be the first example in a beginner's book, doesn't specify it. Is the code wrong?
 
La Lopez
Greenhorn
Posts: 4
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK so i kept searching in the forums, and found that you're not supposed to run this code, it's just an example of what we will be doing later. There was a note in the bottom of the page, and although i read it, I misunderstood its meaning and thought it said that it wasn't real code in the sense that it really doesn't do much. I guess I was just a bit eager to write some code. Thanks -Leo.
 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You are not the first person to think they can execute Party, which is not a complete application.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!