• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Head First Exercise Pg 43

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm having a problem running this program. It compiles and everything but for some reason it doesn't run
I'm still a noob so i know it must be something silly

 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what exactly do you mean by "it doesn't run"? When you try to run it, the OS probably gives you a message telling you exactly what the problem is. That information is actually very helpful in determining the solution - in fact, it is critical.

Please post the exact and complete error message. without it, all we can do is guess at any of the dozen or so possible things it could be.
 
Tariq Ab
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry about that.

this is what i get:

main method not found in class DrumKit, please define the main method as: public static void main (String[] args )
 
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the most helpful error message I think I've seen. It tells you plainly that the compiler is looking for the main() method in your class DrumKit. That's because your file is named DrumKit.java, and the compiler is expecting the class of the same name to contain the required main() method.

You could change the file name to "DrumKitTestDrive.java" or move your existing main() method to your DrumKit class and eliminate the DrumKitTestDrive class entirely, depending on your program or assignment's requirements.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you ought to keep the multiple classes. That is one of the nice things about Head First; they give you the classes and a different class to run them from. It is a good ot become accustomed to using multiple classes.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic