Hi David,

The name of your class is *HelloCommandLineArguments* and not *
HelloCommandLine*. Hence you should run your program as:

c:\myprograms>java HelloCommandLineArguments

Regards,
Babu

On Sat, Aug 1, 2009 at 2:24 AM, David Seto <[email protected]> wrote:

>
>
>
>
> Ran the Example –
>
> public class HelloCommandLineArguments {
>
>     public static void main( String[] args ){
>
>         // Print the string "Hello, " on screen
>         System.out.println("I am saying Hello to the people below.. ");
>
>         // Check if a command line argument exists
>         if(args.length == 0)
>             System.exit(0);
>
>         // Display the arguments from the command line
>         for(int counter = 0; counter < args.length; counter++){
>             System.out.println("argument index " + counter + ": " +
> args[counter]);
>         }
>     }
>
> }
>
>
>
> After running the javac that created the class then ran the java  I got the
> following results
>
>
>
> C:\myjavafxprojects\1038_commandarguments\commandarguments\samples\HelloCommandLineArguments\src>java
> HelloCommandLine
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> HelloCommandLineArguments/class
>
> Caused by: java.lang.ClassNotFoundException:
> HelloCommandLineArguments.class
>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>
> Could not find the main class: HelloCommandLineArguments.class.  Program
> will exit.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to