| 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
|
 |
 |
|
|
subject: what does this error message mean?
|
|
|