1 Reply Latest reply on Apr 6, 2009 12:09 PM by Peter Johnson

    com.sun.tools.javac.Main is not on the classpath

    Anup Jani Newbie

      I was getting following error when tried running a JSP in a simple JSP + Servlet based application on JBoss4.0

      03:09:08,236 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
      Unable to find a javac compiler;
      com.sun.tools.javac.Main is not on the classpath.
      Perhaps JAVA_HOME does not point to the JDK
      at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)

      I ensured tools.jar was present in:
      1. project library
      2. %JAVA_HOME%\lib
      3. C:\JBoss4\server\default\lib

      I also ensured that JAVA_HOME was my JDK root folder.
      i.e. set JAVA_HOME=C:\Program Files\Java\jre1.6.0_04

      But the problem got solved ONLY after placing "tools.jar" inside the "ext" folder like this
      C:\Program Files\Java\jre1.6.0_04\lib\ext\tools.jar

      I think there is class loader's problem in JBoss4.

      Kindly give some helpful comments.
      Anup Jani

        • 1. Re: com.sun.tools.javac.Main is not on the classpath
          Peter Johnson Master

          I have a few observations:

          1) jre1.6.0_04 is not a JDK, it is a JRE.

          2) When installing a JDK, don't install it in Program Files - spaces in the path can confuse various Java libraries. (You can install a JRE in "Program Files", just don't set JAVA_HOME to it.)

          3) Don't use JDK 6u4 - it has too many issues. If you absolutely need to use JDK 6, use the latest version.

          4) JBoss AS 4.0.what? There are vast differences between 4.0.0, 4.0.1, ... 4.0.5. So saying 4.0 does not help to identify what you are running.

          5) JBoss AS 4.0.x (any version) is not qualified to run with JDK 6 - you should be using JDK 5.