I am attempting to set up a Jetty Webapp project in Eclipse Neon and am getting the following error:
Generated servlet error: The type java.lang.CharSequence cannot be resolved
Based on this related post and a few others, I’ve been led to believe this being caused by a version mismatch between Java 7 and Java 8. The project also runs properly on other machines, which also would imply the issue is with my configuration. The accepted answer to the linked post is to either roll back to Java 7, or change the source level of the project to 8. Rolling back to 7 is not an option for me, as the project makes use of Java 8 features.
Im pretty sure I have everything set up for Java 8, but I’m not real experienced in Eclipse, so there could be a setting Im missing. I have set:
in Eclipse
->Preferences
->Java
->Compiler
->Compiler compliance level
: 1.8
in Project
->Preferences
->Java Compiler
->Compiler compliance level
: 1.8
in Project
->Preferences
->Java Build Path
->Libraries
the JRE System Library
is 1.8.0_77
in Run
->Run Configurations
->Jetty Webapp
:
Jetty Version
is Jetty 7.6.8v20121106
JRE
is Project JRE (1.8.0_77)
I have also cleaned, rebuilt, removed and reimported the project, and restarted Eclipse.
Are there any settings I am missing that might still be set to Java 7? Or is there some other reason why I would be getting this error?
the full error message is:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files||PWC6197: An error occurred at line: 17 in the jsp file: /WEB-INF/jsp/dashboard/showfilters.jsp|PWC6199: Generated servlet error:|The method replace(char, char) in the type String is not applicable for the arguments (String, String)||
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
Also, the line in question is:
<a title=" <%= request.getAttribute("title").toString().replace("],", "\n") %>"></a>