我的工程部署在tomcat下,假设我的工程名为“tttt”,在tttt中有两个文件夹:com和pages。其中com里面有b.class,pages里面有a.jsp。
那么我在本机上的完整目录就应该是:
e:\tomcat6\webapps\tttt\WEB-INF\com\b.class
e:\tomcat6\webapps\tttt\pages\a.jsp
我想在a.jsp中调用b.class这个applet文件,其中的HTML代码是这么写的:
<applet code="com.b.class" width="150" height="80"></applet> <applet code="WEB-INF.com.b.class" width="150" height="80"></applet>
和
<applet code="com.b.class" width="150" height="80"></applet>
可是控制台报错:
java.lang.ClassNotFoundException: com.b.class
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/pages/com/b/class.class
和
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/pages/WEB-INF/com/b/class.class 如果我这么写:
<applet code="b.class" codebase="/tttt/com/" width="150" height="80"></applet>
会出现这个错误:
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/com/b/class.class 后面用“.”也不行:
<applet code="b.class" codebase="/tttt/com/b.class" width="150" height="80"></applet>
出现:
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/com/b.class/b/class.class 我很困惑:为什么每个错误后面都有一个b/class.class?我并没有这个.class文件!
那么如何写HTML代码才能够使其访问到b.class这个applet文件呢?
那么我在本机上的完整目录就应该是:
e:\tomcat6\webapps\tttt\WEB-INF\com\b.class
e:\tomcat6\webapps\tttt\pages\a.jsp
我想在a.jsp中调用b.class这个applet文件,其中的HTML代码是这么写的:
<applet code="com.b.class" width="150" height="80"></applet> <applet code="WEB-INF.com.b.class" width="150" height="80"></applet>
和
<applet code="com.b.class" width="150" height="80"></applet>
可是控制台报错:
java.lang.ClassNotFoundException: com.b.class
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/pages/com/b/class.class
和
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/pages/WEB-INF/com/b/class.class 如果我这么写:
<applet code="b.class" codebase="/tttt/com/" width="150" height="80"></applet>
会出现这个错误:
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/com/b/class.class 后面用“.”也不行:
<applet code="b.class" codebase="/tttt/com/b.class" width="150" height="80"></applet>
出现:
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/com/b.class/b/class.class 我很困惑:为什么每个错误后面都有一个b/class.class?我并没有这个.class文件!
那么如何写HTML代码才能够使其访问到b.class这个applet文件呢?
解决方案 »
- 线程栈是个什么东东?
- jdk/jre/lib/charsets.pack文件是做什么用的?
- Main窗体上的子窗体模态显示
- java.endorsed problem
- 如何在Panel上贴图?好困惑~
- eclipse 可以写c函数吗? how?
- 对String.indexOf(String str,int fromIndex);和lastIndexOf(String str, int fromIndex);的困惑!
- 我这用freejava编译简单的HelloWorld.java总是没反应,它也没有任何提示,jdk路径也设好了,jdk是不是非要安装的才行,我的JDK1.3不是安装的,是从JBuilder5直接复制到d:\jdk1.3,谁能告诉我是怎么回事??
- 关于print()被清空求助
- 类全局变量的初始化,两种方式的区别
- gui 编程如何把数据库内容显示到frame里面 可以有删除什么的界面 在线等
- treeviewer如何增加子节点
直接用com.b就可以。另外
<applet code="com.b" width="150" height="80"> </applet>
这样写的话,你b.class文件就应该放到tttt/pages/com/目录下
<applet code="com.b" width="150" height="80"> </applet> 谢谢您的回答,如果把b.class放在pages\com下,可以访问了。
但是如果我要访问在e:\tomcat6\webapps\tttt\WEB-INF\com\b.class的这个applet该如何写呢?<applet code="b" codebase="/tttt/com/" width="150" height="80"> </applet>
可是出现:
java.lang.ClassNotFoundException: b
Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8090/tttt/com/b.class