• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

problem witn code from Head First Java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm beginig with Java. Tried to do the first code from first chapter. After creating of the class Party I used JVM. And got error: main method not found in class party. please define the main method as: public static void main<String[] args> or a JavaFX application class must extend javafx.application.Application
What have I done wrong?

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, wu and Egor!

Egor: Head First Java often leaves out this kind of "boilerplate" code so that the examples are shorter.

wu: Thanks for the solution. Just so you know, we usually don't give complete solutions here, but instead offer advice to help the OP arrive at their own conclusion -- although snippets of code are fine. Also, you should UseCodeTags (that's a link). It makes your code look much better. I'll put them in for you this time.
 
Egor Korenevski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
Ranch Hand
Posts: 269
15
Android Angular Framework Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Egor,
Please checkout the Java Tutorials http://docs.oracle.com/javase/tutorial/ if you get frustrated with "Head First". I have not used Head First, since one early attempt with Java EJBs, but I have frequently found answers for various things in the tutorials.
 
Marshal
Posts: 74050
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The two are different. HFJ is a teaching book intended for not‑quite‑beginners. The Java™ Tutorials are probably the most comprehensive such source available. But has quite short examples.

The Party app in the early chapters of HFJ is notorious because it is incomplete and cannot be executed without adding quite a lot of code.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How I can run the same on IntelliJ Idea IDE Platform?
 
Campbell Ritchie
Marshal
Posts: 74050
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can only use it if you create a class to use it with, maybe called PartyDemo. I would change all the old AWT display classes to their Swing or FX counterparts, e.g. Frame→JFrame.

And welcome to the Ranch
 
reply
    Bookmark Topic Watch Topic
  • New Topic