Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what does this error message mean?

 
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Neil:
how to set up my class path? Thanks
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on what OS that you are running.
 
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my OS is Win2000, so how can i set up java CLASSPATH environment ? how to add it ?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, i figure out, thanks everyone
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic