i suspect if ur class path is set properly.
make a batch file (DOS) of following contents
path = c:\jdk1.4\bin;c:\jdk1.4\lib;.;
set Classpath=c:\jdk1.4\jre\lib\*.jar;.;
set java_home=c:\jdk1.4
Change the path ur JDK in the above code snippet.
Got to command prompt and run this batch file.
After this, try to comple ur code.
Let me know what happens.