[5693] in java-interest

home help back first fref pref prev next nref lref last post

Re: Basic hello world program -fails

daemon@ATHENA.MIT.EDU (Michael Mehrle)
Thu Feb 22 23:25:39 1996

Date: Thu, 22 Feb 1996 14:44:54 -0700
To: Erik Sanchez <sancheze@rintintin.colorado.edu>
From: michael@w3media.com (Michael Mehrle)
Cc: java-interest-digest@java.sun.com

>< I recently bought the book "Teach yourself Java in 21 days", and am
>< experiencing a problem immediately at the beginning of the book. The basic
>< "Hello World" program compiles fine, but when I try to execute it with
>< "java HelloWorld", I get an error that says "can't find class/HelloWorld
>< class". What gives?
>
>Charles, I just bought the same book today and after working through the
>first "day," I thought about your question.  First of all, put the HelloWorld
>in quotes. Like this: java "HelloWorld" Since the class name is more than 8
>characters some dos apps have a hard time with it.  Secondly, don't include
>the .class extension or else you'll get the same error message.  One more
>thing, I can't get the HelloWorldApplet to work (mine or the supplied code).
>It compiles but won't display on netscape or the appletviewer. I can however
>get the second day app to work etc.. go figure?
>
>I hope this is timely enough to help a fellow java novice. Also, this is my
>first "reply" so if I'm doing something wrong someone PLEASE tell me.
>

Actually this is an error. The main method is supposed to be public, so the
working class (little pun ;) goes like this:

public class HelloWorld {
        public static void main(String args[]) {
                System.out.println("Finally!");
        }
}

Have fun!

Michael


                  \\///
                 [ o-o ]
____________OOOo___(.)___oOOO_______________

     http://www.w3media.com/w3media
          michael@w3media.com
           Tel. 310.441.9599
           Fax  310.441.5919

"One man's mundane and desperate existence
     is someone else's Technicolor."
            -Strange Days-


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post