views:

28

answers:

0

I have a NetBeans project with quite a few classes in it.

I've been working on this project for the past 3 weeks, and just started having this issue today. When clicking the "Run Main Project" button in NetBeans, I see the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: stockscreener/Stock
Caused by: java.lang.ClassNotFoundException: stockscreener.Stock
        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)
Could not find the main class: stockscreener.Main.  Program will exit.
Java Result: 1

So I first thought that my Stock.java file was not building. However, NetBeans did not report any errors when performing a clean/build.

I decided to take a look at the "build/classes/stockscreener" directory. After performing a clean/build, I can find Stock.class in my classes/stockscreener directory, however, when I click "Run Main Project" in NetBeans, I immediately see the class disappear (get deleted) from my view of the folder.

I made a few changes since the last time that the project could be successfully run, however these were minor changes to the code, and not to the project configuration (i.e.: the NetBeans GUI).

Note that I can successfully run the JAR version of this project.

Any ideas as to the cause of this?