How to Use an Object Tag to Embed a Java Applet
Oracle's Java runtime software includes a web browser plug-in that runs Java programs embedded on web pages. Programs embedded on web pages are known as Java applets. Java applets are embedded on web pages by adding an HTML tag, such as the object tag, to their source code. The object tag tells the web browser where the Java applet is, how big to make it and what version of the Java plug-in it needs. The object tag is a method of embedding a Java applet that's only recognized by Internet Explorer. Mozilla Firefox and other web browsers won't recognize the tag and run the applet.
Instructions
-
-
1
Open your web page's HTML source file. Consult your web design software or hosting provider's support for more information if you don't know how.
-
2
Begin the object tag by typing "<OBJECT " into your HTML file and pressing "Enter."
-
-
3
Specify that the Java applet should be run with the installed version of the Java plug-in by typing "classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"" and pressing "Enter." If your applet only runs on specific versions of Java, you can substitute a different CLSID instead. Consult Oracle's official documentation for a list of CLSIDs.
-
4
Specify the width of the Java applet in pixels by typing "width="100"," replacing "100" with the number of pixels, and pressing "Space."
-
5
Specify the height of the Java applet in pixels by typing "height="100"," replacing "100" with the number of pixels.
-
6
Finish the object tag by typing ">" and pressing "Enter."
-
7
Start the param tag by typing "<PARAM name="code"" and pressing "Space." The param tag is located inside the object tag and specifies the location of the Java applet file.
-
8
Specify the name of the Java applet on the web server by typing "value=Applet.class," replacing "Applet.class" with the name of the Java applet.
-
9
Finish the param tag by typing ">" and pressing "Enter."
-
10
Close the object tag by typing "</OBJECT>" and pressing "Enter."
-
11
Verify the object tag looks correct. It should look similar to:
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="100" height="100">
<PARAM name="code" value="Applet.class">
</OBJECT>
-
12
Save the HTML source file in your editor.
-
1
References
Resources
- Photo Credit Hemera Technologies/AbleStock.com/Getty Images