异常代码如下:
Multiple annotations found at this line:
- String cannot be resolved to a type
- The method getContextPath() from the type HttpServletRequest refers to the missing type String
解决办法:
1.右击该项目 - Build Path - Configure Build Path , 在 Libraries 选项下,会发现有个出错的jre Libraries,将其Remove掉。
2.右击该项目 - Build Path - Add Library, 选择JRE System Library,选择Workspace defaulr JRE(jdk1.7)(此前JDK已成功安装并配置好), 然后 Finish 。
3.成功解决。
作者:Roger_CoderLife
链接:https://blog.youkuaiyun.com/Roger_CoderLife/article/details/88171338
本文为Roger_CoderLife的原创文章,著作权归作者所有,转载请注明原文出处,欢迎转载!
解决Java项目中String类型缺失问题
本文详细介绍了如何解决Java项目中出现的String类型无法识别的问题,通过调整项目构建路径,移除错误的JRE库,添加正确的JDK1.7系统库,最终成功修复了代码异常。
1万+

被折叠的 条评论
为什么被折叠?



