I am trying to run a hello world java program on Netbeans but its giving me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I compiled and ran it on Command line and it worked. Then, I went back to Netbeans and I ran it again..this time it worked (because HelloWorld.class file is under the src folder). After deleting the .class file from the folder, it did not run again on Netbeans.
It is something to do with Netbeans but I can't seem to figure out what would fix this issue. I checked under project properties -> Libraries -> and the java platform is set to JDK 1.6
I am using Netbeans 7.0 on Mac.
Please help me out :(