javanoclassdeffounderrornetbeans-7

NoClassDefFoundError but class exists


Here is the error:


Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sfclocator/UpdateNameForm
    at sfclocator.SFCViewer.(SFCViewer.java:68)
    at sfclocator.SFCViewer$10.run(SFCViewer.java:1823)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: sfclocator.UpdateNameForm
    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)

I created this program as a Netbeans 7.0 project. I've been working on it for about 2-3 days, and finished it yesterday. It worked perfectly yesterday. I went to sleep, woke up, ran it this morning, and all of a sudden I got errors. I fixed the errors that popped up, except for this one.

The project builds perfectly, and the JAR even runs just fine, but when I try to run the project using Netbeans it gives me this error. Any help would be appreciated.


Further information i just found out:

When built, the UpdateNameForm class exists in the classes folder of netbeans project, but when i click run, it deletes the UpdateNameForm classes.


Solution

  • I have solved my problem by creating a new netbeans project from the existing sources. In my opinion, this is not a good way to do things (especially on large projects) but none of the existing answers provided a solution.