Lab 2
This lab steps through the mechanics of compiling and running applets,
using the light example from class.
- Look at my version of the LightAppletV1Demo.html
- Save versions of each of the listed java source files in your
public-html/classes/csc241
directory
- Save the LightAppletV1Demo.html file itself in your
public-html
directory
- Edit the html file so that all of the URLS and
the codebase
refer to your base URL
(probably ``www.oswego.edu/~loginname'').
- Compile the java files. Usually, the easiest and best way to
compile is from within emacs. For example, when editing java files
hit the F6 key, then
backspace over the prompt saying ``make -k'' and replace with,
in this case, ``javac Light*.java''
- From a shell window, type
appletviewer LightAppletV1Demo.html
- You will see that there is an error leading to a
null pointer exception. (One of the source files
is not actually the same as the ones that produce the running
version.)
- Track down the error (hint: look in LightSwitch), fix it,
recompile, and rerun the appletviewer. Repeat as necessary
until it works.
- When the applet works:
- From your public-html directory, type
chmod og+r LightAppletV1Demo.html
- From your public-html/classes/csc241 directory, type
chmod og+r *.class
- Edit your home page (or somewhere easily and obviously
accessible from your home page) to place a link to your
LightAppletV1Demo.html
- Check that it is accessible and works from netscape.
Doug Lea
Last modified: Fri Sep 20 07:11:19 EDT 1996