java.lang.RuntimeException: Uncompilable source code - what can cause this?

后端 未结 15 2031
梦谈多话
梦谈多话 2020-11-22 16:30

This error is just bizarre, my code compiles fine, I can see there are no problems with it, yet this error has just popped up. I have tried re-starting NetBeans and there is

相关标签:
15条回答
  • 2020-11-22 17:00

    I had the same problem. My error was the packaging. So I would suggest you first check the package name and if the class is in the correct package.

    0 讨论(0)
  • 2020-11-22 17:03

    I had the same issue with one of my netbeans project.

    Check whether you have correctly put the package name on all the classes. I got the same error message because i forgot to put the package name of a certain class (which was copied from another project).

    0 讨论(0)
  • 2020-11-22 17:08

    Just check the packaging, the simplest answer I can provide is that your package has been mislabeled (within a class).

    Also, you may have some weird characters. Try white-flushing the code in a Notepad (or Gedit) and then pasting it into a newly created class with your IDE.

    0 讨论(0)
  • 2020-11-22 17:09

    Disable Deploy on Save in the Project's Properties/Run screen. That's what worked for me finally. Why the hell NetBeans screws this up is beyond me.

    Note: I was able to compile the file it was complaining about using right-click in NetBeans. Apparently it wasn't really compiling it when I used Build & Compile since that gave no errors at all. But then after that, the errors just moved to another java class file. I couldn't compile then since it was grayed out. I also tried deleting the build and dist directories in my NetBeans project files but that didn't help either.

    0 讨论(0)
  • 2020-11-22 17:11

    If it is Netbeans, try to uncheck "Compile on save" setting in the project properties (Build -> Compiling). This is the only thing which helped me in a similar situation.

    0 讨论(0)
  • 2020-11-22 17:12

    I had this problem with NetBeans 8.0.1. Messages about problem in project deleted class. Deleting the ~/.netbeans didn't work. Also I looked for ANY reference to the deleted class in ALL my projects, nothing found. I deleted the build classes, everything. Then, when I started Netbeans again, compile and magically appears the message in Run and into the mother compiled class. I tried the uncheck "Compile on save" Dime solution, and works, but it's not practical. Finally, my solution was edit and force recompile of the mother class. This way the new .class doesn't contains the message and Run works OK.

    0 讨论(0)
提交回复
热议问题