You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@comcast.net> on 2004/02/26 21:01:08 UTC

Re: Run Applet on Tomcat 5.0 -- Where to put the plugin class files?

Henry,

Please respond to the list, so everyone can see this conversation. Also 
note that this isn't really a Tomcat question. It's an applet question. 
However, I'm happy to help.

> 1. I put PluginApplet.jsp in the directory 
> [TomcarInstalledHome]\webapps\ROOT\

Okay, that should be fine. Since IE is trying to load your applet, I 
assume that the page is in the proper place.

> 2. I use IE to browse http://localhost/PluginApplet.jsp
> Result: IE failed in initializing PluginApplet.
> Where should I put the following 4 class files?
> DrawingPanel.class ,PluginApplet.class, TextPanel.class, 
> WindowUtilities.class

First of all, I highly recommend using a JAR file since you have 
multiple class files. I believe that most browsers will use the current 
base URI for loading classes, so your classes should be in the same 
directory as your PluginApplet.jsp file (or, at least, the URL created 
by replacing 'PluginApplet.jsp' with 'PluginApplet.class' should resolve 
to your class file.

> <jsp:plugin type="applet" 
>             code="PluginApplet.class"
>             width="370" height="420">
> </jsp:plugin>

You should, however, specify either the 'codebase' attribute for the 
jsp:plugin element, or use the 'archive' attribute, which would be 
required if you were to use a JAR file.

So, if you JAR'd all your class files together into, say, 
PluginApplet.jar, then your JSP code would look like this:

<jsp:plugin type="applet"
	code="PluginApplet.class"
	archive="/path/to/PluginApplet.jar"
	... other attributes like width, etc. ...
</jsp:plugin>

Hope that helps.
-chris