used following in MS-DOSS command window

public class Welcome1 {
    /*method*/ 
    public static void main( String args [])
    {
    System.out.println( "Welcome to Java Programming!" );
    }/*end main*/
}/*end class Welcome1*/

It was taken as an elementry example of a Jova pgm.

I saved it as Welcome1.java and used the MS-DOS command line, > java Welcome1 There was a momentary hesitation and I received the following Error message

Exception in thread "main" Java.lang.NoClassDefFoundError:Welcome1

I'm trying to learn Java on my own. I'd like some help in taking this first step. Any suggestions????

TonyPerez

Re: Error message when running simple Java pgm 80 80

Heres a dumb question... did you compile it first?

Re: Error message when running simple Java pgm 80 80

use javac Welcome1.java
and then use

java Welcome1

Re: Error message when running simple Java pgm 80 80

use javac Welcome1.java
and then use

java Welcome1

At the dos command prompt I tried "javac Welcome1.java" and I get...... 'javac' is not recognized as an internal or external command, operable program or batch file.

Re: Error message when running simple Java pgm 80 80

You need to add it to your system variables. It depends on what OS you're running as to how to do this. Or you could just type in the full path name like:

C:\Program Files\Sun\JavaSDK\bin\javac.exe program.java
C:\Program Files\Sun|JavaSDK\bin\java.exe program

Of course, your's is probably different. But youshould get the idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.