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

后端 未结 15 2033
梦谈多话
梦谈多话 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:25

    It's caused by NetBeans retaining some of the old source and/or compiled code in its cache and not noticing that e.g. some of the code's dependencies (i.e. referenced packages) have changed, and that a proper refresh/recompile of the file would be in order.

    The solution is to force that refresh by either:

    a) locating & editing the offending source file to force its recompilation (e.g. add a dummy line, save, remove it, save again),
    b) doing a clean build (sometimes will work, sometimes won't),
    c) disabling "Compile on save" (not recommended, since it can make using the IDE a royal PITA), or
    d) simply remove NetBeans cache by hand, forcing the recompilation.

    As to how to remove the cache:

    If you're using an old version of NetBeans:

    • delete everything related to your project in .netbeans/6.9/var/cache/index/ (replace 6.9 with your version).

    If you're using a newer one:

    • delete everything related to your project in AppData/Local/NetBeans/Cache/8.1/index/ (replace 8.1 with your version).

    The paths may vary a little e.g. on different platforms, but the idea is still the same.

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

    Add selenium-server-standalone-3.4.0.jar. It works to me. Download Link

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

    Recheck the package declarations in all your classes!

    This behaviour has been observed in NetBeans, when the package declaration in one of the classes of the package refers to a non-existent or wrong package. NetBeans normally detects and highlights this error but has been known to fail and misleadingly report the package as free of errors when this is not the case.

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