title: Unable to compile class for JSP:Tomcat 9
body: <p>I'm using the latest TomCat version and I've recently installed Eclipse Java EE version so it's also the latest version.
  Btw I do have the latest version of <strong>JAVA SE</strong> (JDK).</p>
  
  <p>This is my class:</p>
  
  <pre><code>    package jsp.demo;
  
  public class ClassForJSP {
  
      public static String lowerCase(String data) {
          return data.toLowerCase();
      }
  }
  </code></pre>
  
  <p>So this is my really simple jsp code: </p>
  
  <pre><code>&lt;%@page import="jsp.demo.ClassForJSP"%&gt;
  &lt;html&gt;
  &lt;body&gt;
      Let's make THIS STATEMENT lower case: &lt;%= ClassForJSP.lowerCase("THIS STATEMENT") %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>Type Exception Report</p>
    
    <p>Message Unable to compile class for JSP: </p>
    
    <p>Description The server encountered an unexpected condition that
    prevented it from fulfilling the request.</p>
    
    <p>Exception org.apache.jasper.JasperException: Unable to compile class
    for JSP: </p>
    
    <p>An error occurred at line: [14] in the generated java file: [D:\Java
    Projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\jspdemo\org\apache\jsp\callJavaClass_jsp.java]
    Only a type can be imported. jsp.demo.ClassForJSP resolves to a
    package</p>
    
    <p>An error occurred at line: [4] in the jsp file: [/callJavaClass.jsp]
    ClassForJSP cannot be resolved 1: &lt;%@page
    import="jsp.demo.ClassForJSP"%> 2:  3:  4:    Let's make
    THIS STATEMENT lower case: &lt;%= ClassForJSP.lowerCase("THIS STATEMENT")
    %> 5:  6:   </p>
    
    <p>Stacktrace:
      org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
      org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:213)
      org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:473)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:392)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)</p>
    
    <p>Note The full stack trace of the root cause is available in the server
    logs.</p>
    
    <p>Apache Tomcat/9.0.14</p>
  </blockquote>