You are using a browser which is not compatible with CSS (for more information, see Tara's tutorial). Because of this, it is possible that our website may not appear correctly in your browser. We apologise for the inconvenience, and recommend you upgrade your browser to one which is compatible with CSS. For more information, please visit our Browser Upgrade page.


Java Applets: Making them work! by Bill

Last updated: 02/05/2012
Adding A Java Applet To My WebPage and Making It Work

First, you need to understand what java applet components are required for your webpage as well as understanding the required HTML statement/instructions that make your applet work correctly on your webpage. You will then be able to install, modify and use these Java Applications with little or no difficulty.

After you have downloaded and unzipped the applet, as most applets are downloaded in .zip format, you will find that it will contain at least one .class file. This is the compiled Java program.

NOTE: There is no need to open the class files in any text editor. By doing so you run the risk of making the applet unusable.

Some applets require multiple class files and, in a few cases, a jar file. These should be provided in the zipped file you downloaded. The linking between these files is automatic from within one or more of these class and/or jar files. The primary .class file is always stated in the first line of the HTML source or markup tags.


<applet code="WhatEver.class" width="in_pixels" height="in_pixels">

Of course this example is in its simplist form and could very well be all that is required to make an applet work.

There can be as many or no parameter specifications as provided by the creator of the applet. For the applets that have parameters, the settings can then be tweaked or customized by you. Options could include: font, font color, font size, bgcolor, audio (.au only), URLink, images (.gif and .jpg), fade, text, etc.


<param name="BGcolor" value="0000ff">
<param name="image" value="photo.gif">

Although it is highly recommended to put all of the class, image, audio, etc. files into the same directory as your HTML source or markup tags for the applet to work, it is not required. In most cases you can call the class file with an added tag linking to the directory where the class file is located and an image, audio, etc. file by linking to the directory where the image, audio, etc. file is located.


<applet codebase="directory_name" code="WhatEver.class" width="in_pixels" height="in_pixels">
<param name="BGcolor" value="0000ff">
<param name="image" value="images/photo.gif">

If you'll notice, in the previous examples, I have used both upper and lower letter cases of  "WhatEver.class" This is probably the number one reason why applets will not work. Most class files are named in this fashion and must remain named exactly as you get them!

In a Nut Shell

1. Copy and paste the applet statement into your HTML Document.

2.Tweak or modify any available parameters.

3. UpLoad the HTML document, along with the class file(s), and any required image, audio, txt, etc. files to your server.

NOTE: .class files and all non-text files must be transferred in the binary mode. For best results, make certain that the class file(s) are in the same directory as your HTML source or markup tags!

4. If you have any trouble running the applet then recheck your syntax, spelling (eg: Upper and Lower Case letters) as well as checking the directory you placed your files into.

NOTE: Most servers support running Java Applets so if they do NOT work correctly then the error is most likely yours and not the server's.

Important: Not all browsers are created equal. Applets run better in IE. "Java Virtual Machine" for IE5 is the thing that executes the applets in your IE5 browser! This can be installed from Also be certain that your browser's "Java JIT Compilier" is enabled. This can be done by clicking on Tools/Options/Advanced in IE5.

Now for questions and answers that may help you figure out what went wrong:

Q. I'm having problems using the applets in Frontpage. Where do I put the files for the applets?

A. The easiest way is to put all the related applet files (class files, images, etc) into the same directory as the web page with the applet html. So, if your web page is in the root - then upload all the applet files there.

Q. I just added a new navigation applet to my website. And I have in it a frame. But when I click a link on the applet it doesn't open in the other window.

A. For the Target value, enter the "name" of the window you want the link to open in. The "name" would be whatever you named that frame/window when you created the frameset.

Q. I cannot get my images to show in an applet. They are all in the same directory and I have linked to them in this way ../images/stars.gif

A.If you are putting all the files in the same directory - including your web page - then you don't the "../"
"../" represents up one level in your directory.

Q. I downloaded a java applet and all of its files ... the problem is that this java requires 2 ".class" files...and in the coding..I only see they stated one ".class" file ... when I try to run it then it show that ".class" file not found

A. Yes, some applets require more than one class file. The main class file is stated in the applets HTML but you need to send them all up to your server into the same directory for the applet to work.

That should just about cover anything you, the end user, will need to know to make your Java Applets work.

© 4WebHelp and Bill

Latest comments on this tutorial
I did create a java program of applet .. compile the program and make class file ... copy the class file in same directory as html file .. when i run the browser with html file ... it display APPLICATION BLOCKED mssage
apllit tag is expired it dos not work in ie
xml will solve all of your php/oracle problems.
learn it. use it.
Daniel, 4WebHelp Team Member
kumar: Java applets are dealt with on the client side, therefore via HTML, so they have nothing to do with PHP.
how can java applets embedding through php
Daniel, 4WebHelp Team Member

Please post your problem (with many more details!) in a more appropriate place - specifically our forums.


Why dosent shockwave work?
Daniel, 4WebHelp Team Member
That is simply because the PC you are on does not have Java installed. Java installation is an option on some browsers, and on some browsers it has to be installed completely seperately. In all cases it's just a limitation of any server-side language, just like Flash, Shockwave, Javascript, etc...
I have a java applet in one web page. When I access the page in some pcs, the applet is not working. Should I change some settings in IE options.
george wilson
I would like to store variables from an applet in an oracle database using PHP. Is this possible? How could it be done?

Add a new comment

This page is © Copyright 2002-2022, 4WebHelp. It may not be reproduced without 4WebHelp's prior permission.