Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoSuchMethodError

 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dear friends please let me know why i am getting runtime error.
Thank you
 
abin awale
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I copied and pasted your code and its working perfectly fine in my eclipse.

Please check the file name of your code. Is it Test.java?
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abin is correct. The java command needs the name of the class where your main() is defined. Notice that you don't need to change the name of your source file, however. Just invoke
java Test
at the command line, in the directory where Test.class is located.
 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abin now it is working with file name Test.java.but as Files with no public classes can have a name that does not match any of the class in this file.please let me know.Thanking You
 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Roben.
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, Aruna. I realized that might be the confusing part, since your source file doesn't have any public classes. The java command still needs the name of the class with the main method on it though.
 
aruna dabas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ruben for clarifying my doubt.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic