When you install
the SDK, the installer will also include a plug-in for the most
common types of browsers that it locates on your system. With this
plug-in you can run all the applet demonstration programs in this
course.
Note:
A plug-in is a third-party program that runs within the browser
environment. Common plug-in's include Apple's Quicktime(TM) video
viewer and Macromedia's Shockwave(TM) animator. After a plug-in
is downloaded and installed the first time, the plug-in will thereafter
run from the local disk and so will not cause further delays.
However, what about other web users who want to run the applets
that you develop with the latest version of Java? You could ask
them also to install the JVM or JRE but that is a big demand just
to run an applet.
Note: The simplest technique
is just to tell the visitors to your applet page to go to www.java.com
and click on the "Get It Now" button to obtain the plug-in.
An earlier option was to set up the applet
tags so that the browser downloads the JVM plug-in from Sun
rather than using the default JVM.
The tag modifications for the plug-in involves some messy HTML
code. For example, the hypertext code for an applet might look
like:
<APPLET
CODE = "HelloWorld.class" WIDTH = "100" HEIGHT = "50">
</applet> |
The hypertext code to run this with the plug-in for both MS Internet
Explorer and Netscape becomes
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = "100" HEIGHT = "50"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-win.cab#Version=1,4,0,0">
<PARAM NAME = CODE VALUE = "HelloWorld.class"
>
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
<PARAM NAME="scriptable" VALUE="false">
<COMMENT>
<EMBED
type="application/x-java-applet;version=1.4"
CODE = "HelloWorld.class"
WIDTH = "100" HEIGHT = "50"
scriptable=false
pluginspage="http://java.sun.com/products/plugin/index.html#download">
<NOEMBED>
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT> |
This code
is rather obscure but you don't have to understand it since there
is a tool to create this code for you.
You simply create your web pages with normal applet tags and then
run the HTML
Converter on these pages to produce new pages with the tags
modified as above. The Converter currently can set up the plug-in
code for Internet Explorer and the Netscape browsers on Windows
and Solaris platforms.
The HTML Converter comes with the installation of the SDK. It is
located in the lib
directory as in C:\sdk1.4.1\lib\
if you installed the SDK in C:\sdk1.4.1. The program in packed in
a JAR file
and you can run it from its directory (or put that directory in
your PATH environmental variable) as follows:
C:\sdk1.4.1\lib>
java -jar htmlconverter.jar -gui
See the HTML
Converter description in the Java
Developers Plug-in Guide for further instructions on running
this utility.
References & Resources
Most recent update: Oct.22.2004
|