Hey all, I feel very stupid, but I can't seem to get "Hello World" dummy program to work. Any help would be appreciated!
I am trying to use the "Head First Java" book to get up to speed with
java, but am running into a fundamental problem that is driving me crazy!
Just the facts 'mam:
Running XP, Service Pack 2 (fixes long environmental variable parameter problems)
I downloaded "JDK 5.0 Update 6 with Java EE" from java.sun.com,
the download completed and installed. I decided it was not what I wanted so I uninstalled it using the uninstaller provided.
I then installed the newest JDK: "JDK 5.0 Update 9"
"jdk-1_5_0_09-windows-i586-p-iftw.exe" and it seemed to install without hassles.
Java JDK lives here: d:\jdk-1_5_0_09
Environment variable JAVA_HOME is: d:\jdk-1_5_0_09
Environment variable CLASSPATH is: d:\jdk-1_5_0_09\lib
Environment variable PATH is: PATH=C:\bat;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\OrCAD\OrCAD_10.0\tools\pcb\bin;C:\OrCAD\OrCAD_10.0\tools\specctra\bin;C:\OrCAD\OrCAD_10.0\tools\PSpice\Library;C:\OrCAD\OrCAD_10.0\too
ls\bin;C:\OrCAD\OrCAD_10.0\tools\fet\bin;C:\OrCAD\OrCAD_10.0\tools\jre\bin;C:\OrCAD\OrCAD_10.0\tools\Capture;d:\jdk-1_5_0_09\bin
When I query javac ("javac -version") I get:
D:\sandbox\project1\src->javac -version
javac 1.5.0_09
javac: no source files ....
When I query java ("java -version") I get:
D:\sandbox\project1\src->java -version
java version "1.5.0_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b03)
Java HotSpot(TM) Client VM (build 1.5.0_09-b03, mixed mode, sharing
When I execute javac, it compiles without errors:
"javac HelloWorld.java"
and produces a HelloWorld.class file.
Code: (saved as HelloWorld.java)
public class HelloWorld
{
public static void main (
String[] args)
{
System.out.println("Hello World");
}
}
If I try to run it directly I get the following error:
D:\sandbox\project1\src->java HelloWorld.java
Exception in
thread "main" java.lang.NoClassDefFoundError: HelloWorld/java
If I try to execute the HelloWorld class I get a similar error:
D:\sandbox\project1\src->javac HelloWorld.java
D:\sandbox\project1\src->java HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
This has to be simple operator error. Any ideas?
Thanks