Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Can't run anything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can Watch "Can New topic

Can't run anything

Jay Ayliff

Joined: Oct 07, 2000
Posts: 2
Hi there,
I decided to try learning Java, so I installed some old magazine cover CD software: Visual Cafe 2 and JBuilder. The first thing I discovered was that Java has changed a lot since then, so I bought Bruce Eckel's Thinking in Java and downloaded and installed the Java SDK from I tried compiling and running the first program from TIJ. It compiled fine, but gave this output when trying to run it:
F:\JDK\tijcode\c02>java hellodate
Exception in thread "main" java.lang.NoClassDefFoundError: hellodate (wrong name: HelloDate)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
Looking at the PATH and CLASSPATH settings, I found settings for Vis Cafe, etc. so I uninstalled them, then uninstalled and reinstalled JDK. I still get this problem. I am running NT, and PATH is set to this:
CLASSPATH is not set.
I've been hammering at this for hours now. What am I doing wrong?
Jay Ayliff
Noah Carroll
Ranch Hand

Joined: Sep 20, 2000
Posts: 96
If it gives a NoClassDefFoundError it means you are either spelling the name of the class wrong (remember it is case sensitive) or you need to set you classpath. add the line

set classpath=%classpath%;f:\jdk\jdk1.3\lib\tools.jar

and hopefully it will work for you.
Jay Ayliff

Joined: Oct 07, 2000
Posts: 2
Case sensitive? I thought it didn't matter 'cos it was a file name! Well I'll be hornswoggled, it works!
Much obliged to ya pardner!
Jay Ayliff
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Some times you may have to add .; to the classpath
so classpath will look like
set classpath=%classpath%;.;f:\jdk\jdk1.3\lib\tools.jar
tom berg

Joined: Nov 29, 2002
Posts: 1
Where abouts do you set the classpath. I am using XP and am compiling using the command prompt. I have defined a ClassPath under the environment variables in the properties of my computer. Also i have tried the line before compiling at the command prompt "set CLASSPATH=C:\jdk1.3.1\bin\" The only way i can compile is to write "java -classpath . HelloDate"
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
When you set the classpath in your environment variables, did you include the current direcory? For example, my classpath looks like this
I agree. Here's the link:
subject: Can't run anything
It's not a secret anymore!