aspose file tools*
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread"main"java.lang.NoSuchMethodError.main" Watch "Exception in thread"main"java.lang.NoSuchMethodError.main" New topic
Author

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

Deborah Gooch
Greenhorn

Joined: Nov 11, 2010
Posts: 6
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.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3054
    
  33

How did you compile and run the program?


Mohamed Sanaulla | My Blog
Deborah Gooch
Greenhorn

Joined: Nov 11, 2010
Posts: 6
I ran javac BeerSong.java from the command prompt and once it compiled it into a .class

I ran java BeerSong

Deborah Gooch
Greenhorn

Joined: Nov 11, 2010
Posts: 6
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?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

They are two completely different languages. Javascript is a client-side language that runs in your browser.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
sean parsons
Ranch Hand

Joined: Oct 18, 2010
Posts: 34
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.


Wants to change the world....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread"main"java.lang.NoSuchMethodError.main
 
Similar Threads
Why does this program start from 60 bottles of Beer and not 99
What is wrong with this else statement?
Head first Beersong
Head First Into Java : 99 bottles of beer song Question
head first java beer song program help