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.
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 Microsoft.com. 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
Page URL: http://www.4webhelp.net/tutorials/misc/java.php
Back to the "pretty" page!
© 2018, 4WebHelp Team.