Hi,
I'm trying to run my first HelloWorld program to
test my
JAVA installation. I'm new to programming so be gentle.
I have searched the forums, checked my PATH and CLASSPATH variables but cannot get my program to run.
Here is the program:
class HelloWorldApp {
public static void main(
String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
It compiles as expected and generates the HelloWorldApp.class file
When I try to run the program I get the following error.
C:\J21>java HelloWorldApp
Exception in
thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
Caused by: java.lang.ClassNotFoundException: HelloWorldApp
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: HelloWorldApp. Program will exit.
I have added CLASSPATH and PATH variables for the JDK
CLASSPATH = C:\Program Files\Java\jdk1.6.0_01\lib\tools.jar
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%%SystemRoot%%\system32;%%SystemRoot%%;%%SystemRoot%%\System32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Enterprise Vault\EVClient\;C:\Program Files\Java\jdk1.6.0_01\bin
Any help would be appreciated. i'm determined to get off the floor this time
Mike