Tuesday, October 31, 2006

Fixing the "No Java compiler available" Error When Running Embedded Tomcat

I created an Eclipse project which runs an embedded version of Tomcat. More about that in a future post. I ran into the following message when I tried to serve a JSP page: java.lang.IllegalStateException: No Java compiler available I downloaded the Tomcat source (gotta love open source!) and found the following lines of code:
  jspCompiler = null;
  if (options.getCompiler() == null) {
    jspCompiler = createCompiler("org.apache.jasper.compiler.JDTCompiler");
    if (jspCompiler == null) {
      jspCompiler = createCompiler("org.apache.jasper.compiler.AntCompiler");
    }
  }
I did a little digging and found that several jar files where not in my classpath: jasper-compiler.jar jasper-compiler-jdt.jar
Post a Comment