• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hello World

 
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?
 
Sheriff
Posts: 9099
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: 9099
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: 9099
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
 
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
 
Trailboss
Posts: 23192
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What operating system are you using?
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic