So I'm learning Java. I've been using EasyEclipse and Netbeans - switched to Netbeans for the easy GUI creator. I did all the basic programs before making a very simple GUI one that I could actually use myself.
I made it in Netbeans, compiled it and tested it in Netbeans etc. So I went to my project folder and located "Main.class" - which I tried to run. It gave me this error:
C:\Java\Snooker\build\classes\snooker>java Main.class Exception in thread "main" java.lang.NoClassDefFoundError: Main/class Caused by: java.lang.ClassNotFoundException: Main.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) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: Main.class. Program will exit.
I tried to execute the HelloWorld program with the same method and it didn't work either. I've done about 45mins of googling and I just can't find a definitive answer to this one. It compiles and runs perfectly in Netbeans. I;m new to Java so I'm right in saying that .class is Java's equivalent to .exe?
As you can see, I made a separate folder for my Java projects - C:\Java. I tried putting the Main.class file in the same directory that Java is installed in just to see - didn't work.
Any help would be awesome! Can't believe I'm getting stuck with something so minor!
This post has been edited by 3xtr4: 12 May 2009 - 02:29 PM