Compile error occurs in JSP after upgrading to JDK8: "The type java.lang.CharSequence cannot be resolved"

I recently updated my JDK version to 8. I have a piece of code that looks like this:

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

      

when i run this it throws an error:

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

      

I updated all the JDK dependencies, but it helped.

+3


source to share


2 answers


I just got hurt yesterday. This is because your server (tomcat I guess?) Does not support Java 8 (for your version).

It is known that tomcat6 and some of the first tomcat7 version do not support Java 8 . You will need to update your server or compile it with Java 7.

From the link I leave below, Brett Brian said:



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

Ref: Unable to compile class for JSP: Type java.util.Map $ Entry could not be resolved. This indirectly refers to the required .class files

+3


source


I have a similar problem updating java to 1.1. This issue is related to using a lower version of the servlet api (<3.0).



Solution: 1: Either downgrade Java 8 to Java v7 or 2: Upgrade the servlet api version to 3.0 or higher.

0


source







All Articles