Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

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: 23074
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What operating system are you using?
 
Evil is afoot. But this tiny ad is just an ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!