• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiling Hello class in Vista  RSS feed

 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.

I just got a new laptop with Vista. I'm trying to compile a simple Hello World program just to test things out.

I put Hello.java in C:\ and it compiles. However, when I try to run it, I get:
Exception in thread "main" java.lang.NoClassDefFoundError:

I've tried other directories too with the same results.

This is getting frustrating. Any help would be greatly appreciated!

 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that your current directory is where the compiled class file is, does it work if you specify a dot (.) as a classpath?

java -cp . HelloWorld

(Note the spaces around the dot.)
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if I did it correctly, but I got the same thing.

For now, I'm just straight up typing the actual directories. What I mean is that when I run this thing, it looks something like:

C:\directories\blah ...blah..\java...\bin> java c:\Hello
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc,

Thanks for your help. I realized what I did. It was a simple case of "is the chord plugged in?" I simply wasn't pointing to the correct directory.

Take Care.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!