943,754 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4992
  • Java RSS
Aug 3rd, 2004
0

Error message when running simple Java pgm

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aperez is offline Offline
2 posts
since Aug 2004
Aug 3rd, 2004
0

Re: Error message when running simple Java pgm

Heres a dumb question... did you compile it first?
Reputation Points: 25
Solved Threads: 7
Junior Poster
Drew is offline Offline
166 posts
since Apr 2004
Aug 3rd, 2004
0

Re: Error message when running simple Java pgm

use javac Welcome1.java
and then use

java Welcome1
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Aug 4th, 2004
0

Re: Error message when running simple Java pgm

Quote originally posted by nanosani ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aperez is offline Offline
2 posts
since Aug 2004
Aug 4th, 2004
0

Re: Error message when running simple Java pgm

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.
Reputation Points: 46
Solved Threads: 2
Junior Poster
Iron_Cross is offline Offline
117 posts
since Jul 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: "String class"
Next Thread in Java Forum Timeline: Need help with Quiz code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC