Hello everyone. I'm trying to run my first
Java program in Windows. I've previously had this working in Linux.
I'm running Windows 7 64 bit. I have the following installed:
- Java(TM) 6 Update 20 (64-bit)
- Java(TM) SE Development Kit 6 Update 19 (64-bit)
I have the following environment variables set:
JAVA_HOME - C:\Program Files\Java\jdk.1.6.0_19
Path - %JAVA_HOME%\bin
On my desktop I have a file called HelloWorldApp.java, which I was able to compile on the command prompt with 'javac HelloWorldApp.java'. This produced a file called HelloWorldApp.class on my desktop. I then ran 'java HelloWorldApp.class' and got:
Exception in
thread "main" java.lang.NoClassDefFoundError: C:\Users\Alec\Desktop\HelloWorldApp/class
Caused by: java.lang.ClassNotFoundException: C:\Users\Alec\Desktop\HelloWorldApp.class
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: C:\Users\Alec\Desktop\HelloWorldApp.class. Program will exit.
Different attempts(running this from the same directory as the java binary, for instance) have produced the same thing.
Any ideas?