How eclipse execute java code when there are compile errors

依然范特西╮ 提交于 2019-12-01 20:16:45
lxgr

Eclipse uses its own Java compiler (called ecj) instead of javac. This compiler allows (partial) compilation of broken source files.

Actually, eclipse tries to compile the class and its not able to compile due to build errors, when you simply run those files it executed the previously compiled class, that were successfully compiled earlier (eclipse tries to compile and build the files on every save as per generic settings).

in order to resolve you can try clean the project before running, while in case of javac, it simply compiles ,

Eclipse shouldn't do that. It leads to ambiguous results. If a class couldn't be compiled, then its corresponding .class file should be removed.

If you check the bin folder, B.class and A.class are present. Not sure why it creates B.class even though B doesn't compile

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