OK, this is the first program I've tried to run on my pc at home. I've gone through a year of programming at high school and learned very little, so I'm doing Head First Java on my own at home. At school I used TextPad to compile and run the code, which is what I'm doing at home for now (eventually I'll move on to use eclipse, methinks). Anyway, I installed the j2se Software Development Kit 1.5 (5.0) Update 6. I hate it how sun puts the Runtime Environment so close to the SDK... ugh! But anyway, I managed to avoid downloading the wrong one.
TextPad compiles the following code correctly:
But when I try to run I get this exception: What's the problem? I read a previous thread with 30 posts about setting the PATH. Is that my problem here?
No the PATH is not your problem, it's the CLASSPATH. You need to make sure that the .class file can be found in the CLASSPATH.
Joined: Apr 24, 2006
In my system variables I have a variable called CLASSPATH with the value "C:\Program Files\Java\jre1.5.0_06\lib\ext\QTJava.zip"
That's for the Java Runtime Environment. What do I need to do with the CLASSPATH to get the program to run properly?
Joined: Feb 07, 2005
One way is to modify the System CLASSPATH and include . for the current directory.
Another option is to set the CLASSPATH on the command line.
You can include multiple directories in the CLASSPATH by seperating them with a semicolon.
Joined: Apr 24, 2006
NEVERMIND GUYS! I just got it to work. What's confusing is the installation instructions sun gives ( http://java.sun.com/j2se/1.5.0/install-windows.html ) does not mention the need to add both a PATH AND CLASSPATH to the User Variables. Now I can use TextPad just like at school!
I didn't realize that Quicktime did that until you just told me, Jesper Young. I guess it was luck that I managed to solve my problem (yes I did have Quicktime installed).
On the other hand, it is Sun's fault and it isn't Sun's fault that Quicktime screws up their SDK. It isn't Sun's fault because someone else's software conflicts with Sun's, while it is Sun's fault because they did not mention in the installation instructions that this is a common problem and how to fix it.