• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error in command line argument

 
Greenhorn
Posts: 19
Netbeans IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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... :-) )
 
reply
    Bookmark Topic Watch Topic
  • New Topic