*
The moose likes Beginning Java and the fly likes what does this error message mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what does this error message mean?" Watch "what does this error message mean?" New topic
Author

what does this error message mean?

eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
when i run javac Hello.java,it compile ok,no error message but when i run java Hello,it shows
Exception in thread "main"
java.lang.NoClassDefFoundError:Hello
what wrong?
my code below:
------------------------------------------------
class Hello {
public static void main (String[] in) {
System.out.print("Hello World!");
}
}
Neil Laurance
Ranch Hand

Joined: Jul 18, 2002
Posts: 183
What is your CLASSPATH environment variable?
If this variable is unset, java will look in the current directory for your class file. If the CLASSPATH is set, you must ensure that the current directory is included in the CLASSPATH.
The simplest way is:
java -cp . Hello
eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
Hi Neil:
how to set up my class path? Thanks
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
That depends on what OS that you are running.


"JavaRanch, where the deer and the Certified play" - David O'Meara
eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
my OS is Win2000, so how can i set up java CLASSPATH environment ? how to add it ?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Try a quick search on this forum. This topic has been talked about a lot. The search page link is at the top right of this page.
Any luck yet?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
ok, i figure out, thanks everyone
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what does this error message mean?
 
Similar Threads
Error
still having trouble
A Basic Question
Error msg in NetBeans 4.1
Error in when compiling in NetBeans 4.1