Question

I've been using Neatbean 7.3.1 to work on my java file XYZ.java, it was running OK, then I made some change, and compiled the project without problem, but when I tried to run XYZ.java, Neatbean 7.3.1 says :

Error: Could not find or load main class XYZ
Java Result: 1

I tried a few times, same error. So I opened Netbeans 7.3 and compiled the project then run XYZ.java, it worked fine. Then I went back to Neatbean 7.3.1 and ran XYZ.java again [without recompiling], it worked fine, but after compiling on Neatbean 7.3.1, it will generate the same error when I run it on both Neatbean 7.3.1 and Neatbean 7.3

I've closed and re-opened Neatbean 7.3.1 a few times, same result. So my conclusion is when I compile the project with Neatbean 7.3.1, the XYZ.java won't run on either IDE, but if I compile the project on Neatbean 7.3, XYZ.java runs on both IDE, it seems Neatbean 7.3.1 somehow corrupts the file in someway, how to fix this ?

Was it helpful?

Solution 2

I figured it out, I renamed the file to XYZ.java_New, and renamed another older version from XYZ.java_Old to XYZ.java, compile it and ran, it worked fine, then I renamed them back, now it runs fine. NB7.3.1 somehow corrupts the file, this process recovers it.

OTHER TIPS

If you're trying to run the program by running the java file and it works but when you click on run project it doesn't, then you need to configure the project to have a main class in the IDE.

If you run it either way and it is not working in 7.3.1 from compiled 7.3 then include more information, as there is something else going on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top