• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

installation probs

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i installed jdk 1.6
everything is fine
i copy pasted the following code

public class HelloWorld
{
public static void main( String[] args )
{
System.out.println("hello world!");
}
}

i compiled
compilation went fine.
when i try to run it
it gives the following msg
"exception in thread "main" Java.lang.NoClassDefFoundError : HelloWorld

what is that supposed to mean???
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What command did you give Java to run.
I very much doubt that this is an installation problem, the error is basicly telling you that Java cant find the HelloWorld class (HelloWorld.class), you need the HellowWorld.class to be either on the classpath, or to be executing java from the directory where HelloWorld.class exists.

G
 
robert stevens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
by the way i gave following the commands
javac HelloWorld.java (i was at the directory where i was saving my programs (not bin) )
//it the created a Helloworld.class file in that directory
java HelloWorld
//this gave me the error message
when i copied the HelloWorld.class file in the bin directory and typed the same command again it worked.

but if it compiles in that directory why does it not run in it???
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you entered the java command to run the program, were you still at the same directory (NOT the JDK bin directory)?

Are you following Sun's Hello World Tutorial for Windows?
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic