问题
Ok, this is really weird. I wrote some codes a day ago, and then edited the codes. Then after hours and hours of editing and rewriting and introducing new classes, I ran the codes, but then I go a response from a "System.out.println()" line that I had long removed. Basically, netbeans seems to be running a much older build of my codes. I've cleaned and re-built my codes and still nothing. It keeps running old codes.
What's going on?
回答1:
In Neatbeans by default settings will run your new code, even if you not build the project again (given that you have not modified the build settings). You can clean and Build the project again. If this also not works, just back up your codes and create a new project and include the source codes and run the project.
回答2:
Maybe you can try to clear netbeans cache
- close NetBeans
- delete cache folder (/home/user/.cache/netbeans)
- open the project and wait for scanning project to finish
回答3:
I had similar problem. I hit "Clean and Build", and then "Run", and it worked.
回答4:
Well, Clean it well! Check for any read only folders in your bin that prevent overwriting of class file. Go to classes folder and check date and time class files got modified.
回答5:
if clean and build didn't do the work for you try SHIFT+F6 rather than just F6 as a shortcut for RUN .That was the case for me and it works now just fine.
来源:https://stackoverflow.com/questions/12636423/netbeans-7-1-running-old-codes-rather-than-new-ones