Perhaps JAVA_HOME does not point to the JDK问题 (JDK1.6.0+ Tomcat5.0 时出现)

文章分类:Java编程

文章分类:Java编程

错误页面提示:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
  
No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
  
          org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:83)
          org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:315)
          org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:406)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:463)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
          org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Perhaps JAVA_HOME does not point to the JDK问题

Unable to find a javac compiler;Perhaps JAVA_HOME does not point to the JDK异常产生原因和解决方法。
安装tomcat的时候指定了jre的路径,导致tomcat_home, java_home都已经添加到了环境变量里,但启动jsp的时候却出现了以下的异常:
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

产生的原因是java.home指到$JAVA_HOME/jre下了,而其lib下的tools.jar跟$JAVA_HOME/lib/tools.jar不一样,编译jsp的时候需要用到后者.

注: java.home在运行的时候就会指向$JRE_HOME.
jdk1.6.0_03

都会出现这种情况.

修改方法:在tomcat控制台(双击tomcate5w.exe)java选项-〉java virtual machine
设置为%java_home%/jre/bin/server/jvm.dll
tomcat控制台java选项-〉Java classpath:
%tomcat_home%/bin/bootstrap.jar;%java_home%/lib/tools.jar
注:%java_home%、%tomcat_home分别指jdk、tomcat的安装根目录

 

tomcat_home, java_home都已经添加到了环境变量里,但启动jsp的时候却出现了以下的异常
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
解决方案:
只要把JAVA_HOME/lib/tools.jar拷到TOMCAT_HOME/common/lib下,重启动Tomcat,OK

 

以上jdk1.6.0_03 +tomcat5.0.28出现上述现象,并按相应方法解决

错误页面提示:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
  
No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
  
          org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:83)
          org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:315)
          org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:406)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:463)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
          org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Perhaps JAVA_HOME does not point to the JDK问题
转自: http://zfsn.javaeye.com/blog/738444

Unable to find a javac compiler;Perhaps JAVA_HOME does not point to the JDK异常产生原因和解决方法。
安装tomcat的时候指定了jre的路径,导致tomcat_home, java_home都已经添加到了环境变量里,但启动jsp的时候却出现了以下的异常:
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

产生的原因是java.home指到$JAVA_HOME/jre下了,而其lib下的tools.jar跟$JAVA_HOME/lib/tools.jar不一样,编译jsp的时候需要用到后者.

注: java.home在运行的时候就会指向$JRE_HOME.
jdk1.6.0_03

都会出现这种情况.

修改方法:在tomcat控制台(双击tomcate5w.exe)java选项-〉java virtual machine
设置为%java_home%/jre/bin/server/jvm.dll
tomcat控制台java选项-〉Java classpath:
%tomcat_home%/bin/bootstrap.jar;%java_home%/lib/tools.jar
注:%java_home%、%tomcat_home分别指jdk、tomcat的安装根目录

 

tomcat_home, java_home都已经添加到了环境变量里,但启动jsp的时候却出现了以下的异常
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
解决方案:
只要把JAVA_HOME/lib/tools.jar拷到TOMCAT_HOME/common/lib下,重启动Tomcat,OK

 

以上jdk1.6.0_03 +tomcat5.0.28出现上述现象,并按相应方法解决

你可能感兴趣的:(java,jdk,tomcat,jsp,exception,compiler)