aspose file tools*
The moose likes Applets and the fly likes Applet in a html page and using Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet in a html page and using Tomcat" Watch "Applet in a html page and using Tomcat" New topic
Author

Applet in a html page and using Tomcat

Drake Almonto
Greenhorn

Joined: Apr 29, 2005
Posts: 16
I am new to using a Tomcat server and new to applets also. I am having the following problem and I was hoping that someone could help.

I have an html page in my web application that contains an applet. The applet classes are being obtained from a jar file as specified in the applet tag with "archive=". When I start the Tomcat server and access the html page from internet explorer on the SAME machine where the Tomcat is running, the page and applet display fine. When I go to another computer on the network and try to access the same html page in internet explorer, the page appears ok, but the applet portion is not there. There is just a blank area where the applet should be. The status bar says that the applet did not init. All of my other jsp pages and html pages are appearing fine on both computers. It is just the applet that does not work on the other computer.

I appreciate any help that anyone can give me. Do I need to physically copy the applet classes to some location on the other computer? Or how can I fix this?

Any suggestions will be appreciated.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
What does the APPLET tag in your HTML page look like? Is the applet jar file in the same directory as the HTML page?

In general, there may also be a more elaborate error message in the Java Console.


Ping & DNS - my free Android networking tools app
Drake Almonto
Greenhorn

Joined: Apr 29, 2005
Posts: 16
The jar file is in the same directory as the html. They are both in the top directory within the web application itself. A snapshot of part of the web application structure is shown below.

It looks like this:

Tomcat_directory
...webapps
......Customer (project directory within webapps)
.........tp.html (html file with applet tag)
.........tp.jar
.........WEB-INF
............classes

The applet tag is as follows:
<applet code="TP.class" archive="tp.jar" width="600" height="380"></applet>

I will check out the java console to see what it says.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
That looks OK. So you're saying that

http://localhost:8080/Customer/tp.html

works on that machine, while

http://machine-name:8080/Customer/tp.html

from some other machine doesn't? That's odd.
Drake Almonto
Greenhorn

Joined: Apr 29, 2005
Posts: 16
Yes. It works on one machine but not on the other machine.

I had never looked at the Java Console before and I did not know how to do that. After reading your message and doing some research, I was able to determined how I could see the Java Console when the applet runs. There is a message appearing about the wrong version of Java on that machine. The working machine has Java 1.6 (I believe) and the non-working machine has 1.4.2. I am guessing that I need to update the version of Java on that machine. Does that seem like it could be the problem?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Yes, that could very well be the problem. The applet has apparently been compiled with a version newer than 1.4 (i.e., at least 1.5 or even 1.6). Either upgrading the Java installation to 1.6, or recompiling the applet with 1.4 (assuming that it doesn't use features introduced in 1.5 or 1.6) should do the trick.
Drake Almonto
Greenhorn

Joined: Apr 29, 2005
Posts: 16
ok. thanks for your help.
 
jQuery in Action, 2nd edition
 
subject: Applet in a html page and using Tomcat