This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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
 
Don't get me started about those stupid light bulbs.
 
subject: what does this error message mean?