eclipse修改代码时经常碰到“XX cannot be resolved to a type”的报错信息。
既不是jdk不匹配(或不存在) 也不是 jar包缺失或冲突
只需要操作一下 Project | Clean... ,问题即可解决。
原因是,机制所致。因为某些特殊原因,eclipse没能自动编译源代码到build/classes(或其他classes目录),导致类型查找不到。
Windows–>Preferences–>Java–>Compiler–>Building–>Output folder
勾选 ”Rebuild class files modified by others”.