Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Question about programming with java: NoSuchMethodError?
Hey guys, I really need help. I keep getting the error 'Exception in thread "main" java.lang.NoSuchMethodError: main' when I try to run my java programs. I write my code using TextPad and it always compiles successfully, but when I try to run the program, I get that error. I checked all my class names and all my syntax and everything is fine, but I keep getting the error. The odd thing is that SOMETIMES the programs are running successfully, then when you try to run it again, the error shows up! It's really frustrating and I can't find a solution in plain English which I can understand anywhere! Please, if aanyone can help me, I would really appreciate it. Don't know if any of this info helps: OS: Windows Vista, Text Editor: TextPad, and I'm using jdk1.6.0_12.
It would be a great help if you could give your answers with as much detail as you can so I can follow the instructions and figure out what to do. Thanks. :)
6 Answers
- Germann ALv 71 decade agoFavorite Answer
As BOTH answers mentioned before:
the method is NOT available, this can be caused by compiling and running under (radically) different versions of Java, if you are sure that you compiled your program with 1.6, make sure that you are running it using compatible JVM, check your path AND classpath...
- ErikaLv 45 years ago
i did no longer examine by using all of the code, so there must be greater issues incorrect with this... yet in java, length of an array is a public quantity and not a manner. So s.length() is faulty it is going to be s.length The java compiler is cribbing appropriate to the lenth() approach no longer being attainable. i think of thats a false impression those with previous exposure to C++ convey to java.
- 1 decade ago
Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method.
Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.
You're likely calling a method that has been removed from your current JDK.
- 1 decade ago
Why don't you try using an IDE like Eclipse or NetBeans....it would change u'r life :-) ! I know it's not the answer u were looking for but it's so much easy to find the problem.....NetBeans it's the easiest way to build an UI. Give it a try!
- How do you think about the answers? You can sign in to vote the answer.
- FudgeLv 51 decade ago
Basically provide a main() method in ur class . A main() starts ur application by creating objects and calling their methods ,regardless of how long ur code is
Example : assume ur class is called Foo:
class Foo { //code
public static void main(String[] args)
{
System.out.println("Foooo");
}
}
- Anonymous1 decade ago
This post answers this question very well.
http://computerprogrammingacademy.com/javablog/200...
Read the post and I bet that is where you are going wrong.
Good luck
Source(s): http://computerprogrammingacademy.com/java