• Post Reply Bookmark Topic Watch Topic
  • New Topic

error in command line argument  RSS feed

 
Preethi sakar
Greenhorn
Posts: 19
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to this Ranch..

class A
{
public static void main(String a[]){
System.out.println(a[0]);
}
}

This is my code.... i got error......

Exception in thread "main" java.lang.NoClassDefFoundError:a(wrong name: A)

Advance Thanks....
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. How are you running this code? Post the commends you're entering on the command line.
 
Preethi sakar
Greenhorn
Posts: 19
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank for reply...

this is my commend use to running

javac a.java

java a 1 2
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So: The exception talks about "a" and "A". What could that mean? And what is a java.lang.NoClassDefFoundError? If you don't know, read its javadocs.

(Don't get confused by your use of "String[] a", that's not what this so about. But you should nonetheless change that to "String[] args", because that is what everyone uses. So unless you want to confuse every Java developer under the sun except yourself... :-) )
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!