Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hello World

 
Tim Bachta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran the hello world program. It was able to compile but when I ran it I received the following message:"Exception in thread "main" java.lang.NoClassDefFoundError: Hello World " did I do something wrong?
 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your class name is HelloWorld (all one word), right?
You compiled "javac HelloWorld.java" ?
You then typed "java HelloWorld" ?
From the error message, it appears that you tried to split the class name into two words (i.e. java Hello World).

 
Tim Bachta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually it is comming out as HelloWorld all one word??
I saved the file as HelloWorld.java the class anme is HelloWorld what else could be wrong?
 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What subdirectory are you in when you compile? What subdirectory is your HelloWorld.java file in? What is your path set to? What is your classpath set to?
 
Tim Bachta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are all in the Java folder which is located in the root of C: Drive and I compile and reun in that directory
 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your CLASSPATH set to?
 
Tim Bachta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the settings that I have
PATH=C:\windows;c:\windows\command;c:\jdk1.2\bin;C:\jdk1.2\jre\bin
CLASSPATH=C:\jdk1.2\lib;.;C:\java
I am still getting an error
 
Daniel Olson
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may not be your problem, but I have gotten that error when I forget and type
java HelloWorld.java
instead of
java HelloWorld
 
paul wheaton
Trailboss
Pie
Posts: 21515
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What operating system are you using?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic