| 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
Bartender
Joined: Sep 08, 2007
Posts: 2926
|
|
|
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
Bartender
Joined: Aug 16, 2005
Posts: 12909
|
|
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....
|
 |
 |
|
|
subject: Exception in thread"main"java.lang.NoSuchMethodError.main
|
|
|