当前位置: 技术问答>java相关
新手javaBean中classpath路径设置问题
来源: 互联网 发布时间:2015-09-21
本文导语: 很奇怪的事情,直接在ms-dos下运下javac编译不成功,但用jcreator pro编译成功的.class放在classpath指定的目录下,但运行下面的jsp还是报错,.jsp源码如下: 无标题文档 部分出错信息如下: exception org.apache.jaspe...
很奇怪的事情,直接在ms-dos下运下javac编译不成功,但用jcreator pro编译成功的.class放在classpath指定的目录下,但运行下面的jsp还是报错,.jsp源码如下:
无标题文档
部分出错信息如下:
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:43: package test does not exist
test.helloWorld test = null;
^
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:45: package test does not exist
test = (test.helloWorld) pageContext.getAttribute("test", PageContext.PAGE_SCOPE);
^
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:48: package test does not exist
test = (test.helloWorld) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "test.helloWorld");
^
3 errors
请高手们指教,问题解决后马上送分,
apache tomcat4.1 + j2sdk1.4.1 + win2k
无标题文档
部分出错信息如下:
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:43: package test does not exist
test.helloWorld test = null;
^
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:45: package test does not exist
test = (test.helloWorld) pageContext.getAttribute("test", PageContext.PAGE_SCOPE);
^
An error occurred at line: 1 in the jsp file: /testbean.jsp
Generated servlet error:
C:Program FilesApache GroupTomcat 4.1workStandalonelocalhost_testbean_jsp.java:48: package test does not exist
test = (test.helloWorld) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "test.helloWorld");
^
3 errors
请高手们指教,问题解决后马上送分,
apache tomcat4.1 + j2sdk1.4.1 + win2k
|
test.helloWorld
这个类的原代码怎么写的,能不能编译通过。
检查方法
你可以这样写
看jb下提示会不会正常
这个类的原代码怎么写的,能不能编译通过。
检查方法
你可以这样写
看jb下提示会不会正常
|
是你的javabean 的路径不对,你在/web-inf/classes下面建立一个test文件夹
helloWorld.classes放进去就可以了。
helloWorld.classes放进去就可以了。
|
我也遇到过此问题,我将应用目录与tomcat放置在一个盘上就ok了