• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

simple applet won't run

Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I coded up a simple applet and some html with an applet tag and it tested out OK using the applet viewer. But it doesn't do anything (except draw a grey empty box 100x200) when executed from the application server.
For the applicaton server test, I put the applet tag in the HTML Body of the JSP page i.e.
<applet code=CatApplet.class height=100 width=200> </applet>
The applet class file is in the same directory as the JSP page. The source for it is:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import java.util.Date;
public class CatApplet extends JApplet
public void init ()
resize (250,100);

public void paint (Graphics g)
g.drawString ("lets get some cat gui going", 35, 15);
Why won't my applet run when the applet tags are in the JSP page?
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't have anything to do with the JSP, it has to do with you using Swing (JApplet). Regular <applet...></applet> tags don't work, you need to run it through an HTML Converter.
My suggestion, create an HTML file first with
Run the HTML Converter over that HTML file, then cut and past what is added to the HTML file into your JSP.
Either that, or make sure your browser has the latest plugin that can view Swing. Never gotten this to work, but some people have I believe.
There is a JSP plug-in tag that allows you to download the plugin from whatever source to the browser that is trying to run the applet, could use that in your JSP and make it more portable and not having to rely on the browser configuration.
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried its not working
Posts: 21972
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Posts: 25677
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Advice about applets from 2002 is also useless. So if you have an applet problem, Jack, and you can't find current (i.e. within the last year) advice about it, I would suggest asking a question here.
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic