学习Struts-郁闷的第一步,环境问题

类别:Java 点击:0 评论:0 推荐:
今天有点心血来潮,突然想自己整个struts的应用学习一下,于是拿来前阵子买的《精通struts:基于MVC的Java Web设计与开发》,看到第二章,有个非常简单的例子,因此觉得拿来上手。
启动tomcat5.0.19,在地址栏输入http://localhost:8080/helloapp/,......居然显示了一页编译错误,很是郁闷。
错误信息如下:

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...

开始查找原因,设置了环境变量后,重新启动了tomcat,结果错误依旧,痛苦万分~
上google,果然好用,一下就找到了解决方法:
         1. Make sure the following environment variables are set correctly:  
>>> JAVA_HOME points to "C:\j2sdk1.4.2" (correct folder if changed)                           
>>> CLASSPATH points to %JAVA_HOME%\lib                                                       
>>> PATH points to %JAVA_HOME%\bin                                                            
2. copy $JAVA_HOME/lib/tools.jar to the common/lib directory of the Tomcat server             
3. Update your registry to reflect the new JVM location:                                      
key:  HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Apache                                 
Tomcat/Parameters/JVM Library                                                                 
value:      C:\j2sdk1.4.2\jre\bin\server\jvm.dll

本文地址:http://com.8s8s.com/it/it14499.htm