Recently when I write any code and compile it, then try to run it I get this exception:
Exception in thread "main" java.lang.NoSuchMethodError
At first I thought there is something wrong in my code, but I couldn't find anything wrong with it. When trying to run a HelloWorld
example that had worked before, if works, but if I copy the exact same code into a file HelloWorld2
I get this exception again.
The code is identical but when I used javap
to decompile both class files I found a difference. In HelloWorld
(the original file)
"public static void main(java.lang.String[])";
and in HelloWorld2
(the new one)
"public static void main(String[])";
without java.lang.
.
I recompiled the old HelloWorld
with javac
and now when I try to run it it doesn't work and I get the same exception. None of my old code now works if I recompile it.
I've searched everywhere but can't find a solution to this problem - any idea what is going on here?