• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Hello World

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your CLASSPATH set to?
 
Tim Bachta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Trailboss
Posts: 24072
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What operating system are you using?
 
reply
    Bookmark Topic Watch Topic
  • New Topic