NetBeans 4.1 and projects with existing sources: NoSuchMethodError

I'm running NetBeans 4.1 with JDK 1.4.2_06 and I have a project that I've created with existing sources. I can compile everything without issues, however, when I try to run my file within the project for testing purposes, NetBeans recognizes that a main method exists, but I get the following error message:

java.lang.NoSuchMethodError: main

Exception in thread "main"

Java Result: 1

At this point, my class is just:

package nites.mda.configproperties;

public class Debuggable {

public static void main(String[] args) {

System.err.println("Main");

}

}

However, when I create a brand new Java project without existing sources, it will run perfectly fine. The class in this project is:

package test;

public class testClass {

public static void main(String[] args) {

System.err.println("Main");

}

}

Anyone ever come across this issue before?

[984 byte] By [enoch1024a] at [2007-10-2 4:06:30]
# 1

The default project run settings in NB 4.1 use the "compile-time libraries" before they check recently compiled sources. If you have an old version of the file you are trying to run in a .jar file somewhere in your compile-time libraries NetBeans will use that file. If that old file does not have a main method you will get the error you mentioned.

You will be able to compile your class because when compiling NetBeans will work on changed files and only access the compile-time libraries when needed.

The new project will have no old .jars in its path so you will not run into this conflict.

I would first try to remove the old copy of your file from the compiling sources path.

If you can't remove the file try reordering the project抯 libraries listed under project properties -> libraries-> 搑un?tab so that your 揷ompiling sources?are listed before your "classpath for compiling sources"

-Mark

mark1348a at 2007-7-15 23:29:21 > top of Java-index,Developer Tools,Java Compiler...