NetBeans refactor class: java.lang.NoClassDefFoundError

随声附和 提交于 2020-01-05 02:52:47

问题


I just came across an error when using NetBeans, and I wanted to post my findings (possible this is old news). Perhaps this will save some people the headache of debugging a similar problem that I just encountered. I don't think I'm abusing anything here... stack overflow's SEO is pretty good :)

I refactored a class in NetBeans (JavaFX project), and from that point on I got a "java.lang.NoClassDefFoundError" for that particular refactored class.

I fixed the error by simply doing a "Clean and Build Project." This apparently deleted whatever cache file or erroneous file/class reference. I don't think this is a Netbeans bug... hoping it was just one of those "flukey" moments.

Cheers!


回答1:


I have those issues from time to time when I write new code (or create new code). This is because I use the 'build' function instead of 'clean & build'.

Most of the time, the proper set of class is compiled (or recompiled), but there are situations where newly compiled classes are not compatible with already compiled classes. That's when I get java.lang.NoClassDefFoundError. Not a big deal. Just need to clean and recompile everything.



来源:https://stackoverflow.com/questions/3425801/netbeans-refactor-class-java-lang-noclassdeffounderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!