David pay attention to the "*C*" there is java and there is a java*C*
java*C* is the compiler that creats the " .class" files, and java is the
interpreter which runs the " .class" files.
As all mentioned above to compile first type:
java*C* HelloCommandLineArguments.java
Then to Run type:
java HelloCommandLineArguments




**

On Tue, Aug 4, 2009 at 9:46 AM, Kaka madiba <[email protected]> wrote:

>   should not include the class extension to run your java program. You
> would have just typed java HelloCommandLineArguements
>
> --- On *Mon, 8/3/09, David Seto <[email protected]>* wrote:
>
>
> From: David Seto <[email protected]>
> Subject: [java programming] Re: Lab 1038 Command Line Arguements got an
> error message
> To: "'Babu Rajendran'" <[email protected]>
> Cc: [email protected]
> Date: Monday, August 3, 2009, 2:07 PM
>
>
>  Sorry for the typo –
>
> I meant I typed in Java HelloCommandLineArguements.java
>
> It created the class.
>
> Then typed in javac HelloCommandLineArguements.class
>
> Then got the error message listed below 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.
>
>
>
> *From:* Babu Rajendran [mailto:[email protected]]
> *Sent:* Friday, July 31, 2009 9:05 PM
> *To:* [email protected]
> *Cc:* [email protected]
> *Subject:* Re: [java programming] Lab 1038 Command Line Arguements got an
> error message
>
>
>
> 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]<http://us.mc314.mail.yahoo.com/mc/[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