• 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

Exception in thread"main"java.lang.NoSuchMethodError.main

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know why I am getting the above error.

Here is the file created and saved as BeerSong.java

It compiled into a class but when I try to run it I get the message on the subject line and don't know why. I am new at this and learning from the book "Head First Java - 2nd Edition.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you compile and run the program?
 
Deborah Gooch
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran javac BeerSong.java from the command prompt and once it compiled it into a .class

I ran java BeerSong

 
Deborah Gooch
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I finally figured it out. When I first compiled it there were errors. I corrected them an resaved the original file but did not delete and recompile it. I just now did it and it worked. Sorry.

Can I ask what the difference is between Java and JavaScript in this forum?
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are two completely different languages. Javascript is a client-side language that runs in your browser.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I once saw a comic which explained the difference between Java and JavaScript with the question: What is the difference between ham and hamster?

The only reason that the word "Java" is also in the name of the language JavaScript is because Netscape and Sun in 1997 thought that Java was a cool name, and for marketing reasons they decided upon that name - but JavaScript really has nothing to do with Java.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice we are reading the same book, i did that exercise the other day i am now on the battle shit exercise but i decided to try to make my own code from scratch made me learn alot more than just looking at the book and copying.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic