Hello,
I have been learning java recently on Ubuntu and my MacBook, which has been working completely fine, but I have run into some problems now that I have started doing some on Windows Vista as well.
My JDK version is 1.6.0_12 and I although I had a previous version of the JRE installed when I came across this problem, I have since removed the older JRE and the problem persists.
Here is the full .java file that I am trying to run (written with Notepad++):
|
Code:
|
class comparisonDemo {
public static void main(String[] args) {
int value1 = 1;
int value2 = 2;
if(value1 == value2) System.out.println("value1 == value2");
if(value1 != value2) System.out.println("value1 != value2");
if(value1 > value2) System.out.println("value1 > value2");
if(value1 < value2) System.out.println("value1 < value2");
if(value1 <= value2) System.out.println("value1 <= value2");
}
} |
This is just one of the basic examples from Sun's java tutorial.
I am compiling this using the command line interface only, as I have been doing on my Mac and Ubuntu. The file (comparisonDemo.java) compiles fine when I enter:
|
Code:
|
javac comparisonDemo.java |
but upon entering:
|
Code:
|
java comparisonDemo.class |
I am presented with the following error:
|
Code:
|
Exception in thread "main" java.lang.NoClassDefFoundError: comparisonDemo\class
Caused by: java.lang.ClassNotFoundException: comparisonDemo.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessControler.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: comparisonDemo.class. Program will exit. |
After a good hour with Google I haven't been able to find anything that solves the problem. Can anyone with a little more experience think of anything? Of course, things are still working fine on the other two computers so this isn't going to hurt me too much, but I'd really like to figure out what's going on here.
I appreciate the help.