Dunno why this happens... Ok here is the situation: I have a nb project on my laptop. I have the same project on my desktop. I copy the sources (not the entire project) on the desktop, overwriting the desktop sources. Everything cleans and builds ok. Then I start the debugger. On the main class I can debug step by step. If it goes into an internal method here is what happens:
Listening on 37574
User program running
LineBreakpoint test.java : 45 successfully submitted.
Breakpoint hit at line 45 in class test by thread main.
Thread main stopped at test.java:45.
User program running
Not able to submit breakpoint LineBreakpoint baseControllerManager.java : 41, reason: No executable location available at line 41 in class baseClasses.JNW.baseControllerManager.
Invalid LineBreakpoint baseControllerManager.java : 41
Debugger stopped on uncompilable source code.
User program finished
As you can see until I'm in static method main it works (line 45) as I jump inside a non static method (that is an override) it comes out with that... I tried to:
What do you suggest?
For the sake of completeness I'm attaching the sources of the main class:
import baseClasses.JNW.baseAction;
import baseClasses.JNW.baseContResult;
import baseClasses.JNW.baseController;
import baseClasses.JNW.baseControllerManager;
public class test {
public static class starter extends baseController {
public static final String ACTION_START = "ACTION_START";
@Override
public baseContResult doAction(baseAction action) {
if (ACTION_START.equals(action.action)) {
manager.log("action start...");
return new baseContResult(RESULT_OK, baseContResult.resultType.RESULT_OK);
}
return super.doAction(action);
}
@Override
public void init() {
super.init();
}
}
public void startMe() {
baseControllerManager manager;
try {
manager = new baseControllerManager();
} catch (Exception e) {
e.printStackTrace();
return;
}
starter st = new starter();
manager.setMainController(st);
manager.doAction(new baseAction(starter.ACTION_START));
}
public static void main(String args[]) {
test te = new test();
te.startMe();
}
}
Look in the file nbproject/project.properties
for the property javac.debug
and make sure that it's "true". If it is, grep for that property elsewhere in the nbproject directory and any local ant settings.
On a semi-related note: when I'm creating a project in NetBeans, even if the sources already exist elsewhere, I always create a new "Java Application", and let it populate the project directory as it wants. Then I can move in my sources and update the project, and NetBeans stays happy.
Edit after you tried setting javac.debug
:
Looking at your question again, I see that you were able to set a breakpoint on test.java
, but not able to set one on baseControllerManager.java
. That indicates to me that you're getting the latter class from a JAR somewhere, not from your project directory.
So the first step is to make sure that you haven't defined a CLASSPATH
environment variable. This is never a good thing to do, regardless of whether you're using an IDE or a manual build.
Next step is to look at the libraries that you've specified for the NetBeans project. You can use grep
on a JARfile; the file directory is in plaintext. It should be sufficient to look for the unqualified classname.
And the final thing is to verify that you are indeed compiling the class, by looking for it in the build directory.