我在一个由tomcat 6 servlet提供的HTML页面中有一个applet。 applet元素如下:
<applet code="com.iteloffice.cuba4remedy.cubaapplet.class" name="cubaapplet"
codebase="http://localhost:8080/cuba4remedy/classes" width="400" height="400" MAYSCRIPT>
<param name="populatefunction" value="populatedropdown">
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</applet>
在我的开发机器上,applet下载得很好。但是在具有完全相同版本的Java和tomcat的目标机器上,我得到applet错误,如下面IE9中所示。
Java Plug-in 1.6.0_26
Using JRE version 1.6.0_26-b03 Java HotSpot(TM) Client VM
User home directory = C:\Users\Administrator
load: class com.iteloffice.cuba4remedy.cubaapplet.class not found.
java.lang.ClassNotFoundException: com.iteloffice.cuba4remedy.cubaapplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: com.iteloffice.cuba4remedy.cubaapplet.class
如何验证类路径的路径?
E.G。 tomcat在http://192.168.0.6:8080
webapps
文件夹为cuba4remedy
我是否可以在网络浏览器中输入此路径?
http://192.168.0.6:8080/cubaremedy/com/iteloffice/cuba4remedy/cubaapplet.class
applet中的包语句是:
package com.iteloffice.cuba4remedy;
tomcat文件夹结构中的是这样的:
tomcat_root/webapps/cuba4remedy
内cuba4remedy
个类文件位于:
WEB-INF/classes/com/iteloffice/cuba4remedy
编辑:
要解决此问题,我更改了applet标记,如下所示,并将applet类文件放在webapps根文件夹中
<applet code="cubaapplet.class" name="cubaapplet"
codebase="/cuba4remedy" width="400" height="400" MAYSCRIPT>
<param name="populatefunction" value="populatedropdown">
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</applet>
我看到另一篇关于无法访问servlet可以访问的路径的文章。
将代码库更改为/使其更加灵活。