编程语言
首页 > 编程语言> > 更新到JDK8之后,JSP中会发生编译错误:“类型java.lang.CharSequence无法解析”

更新到JDK8之后,JSP中会发生编译错误:“类型java.lang.CharSequence无法解析”

作者:互联网

我最近将JDK版本更新为8.我有一段代码如下:

     StringBuilder abc = new StringBuilder();
     abc.append("123");

当我运行它时,它抛出错误:

The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files

我已经更新了JDK的所有依赖项,但注意到有所帮助.

解决方法:

我昨天才受苦.这是因为您的服务器(我猜是tomcat?)不支持Java 8(针对您所使用的版本).

众所周知,tomcat6和tomcat7的某些第一个版本不支持Java8.您必须更新服务器或使用Java 7对其进行编译.

从参考中,我在下面离开,Brett Bryan说:

I can confirm that apache-tomcat-7.0.35 does NOT have support for
JDK8, I can also confirm that apache-tomcat-7.0.50 DOES have support
for JDK8.

参考号:Unable to compile class for JSP: The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

标签:java-8,tomcat,java,jsp
来源: https://codeday.me/bug/20191120/2042625.html