Readme

Overview

Assignment 3 is implemented as a Java applet, and it is available here in compiled form. This readme file describes how to download, build, and install the applet on another account (similar to mine) at uhunix2.its.hawaii.edu.

Download

The applet source code is available from this site along with the HTML files required to host it on a web server. A complete set of files is available here as a tar/gzip archive. Once downloaded, transfer the archive to a directory of your choice on uhunix2. The remainder of this readme file will assume it has been downloaded to ~/tmp.

uhunix2:~/tmp% ls
yucheng-ics311-hw3.tar.gz

First, extract the files from the tarball. This will produce a hw3 directory in the current directory and several files and directories inside of it.

uhunix2:~/tmp% gzip -dc yucheng-ics311-hw3.tar.gz | tar xf -
uhunix2:~/tmp% ls -1
hw3
yucheng-ics311-hw3.tar.gz

In case the file permissions were lost due to the tar/gzip process, it is a good idea to reset them. The following commands will give all directories 755 permissions, all files 644 permissions, and all shell scripts 755 permissions.

uhunix2:~/tmp% find hw3 -type d -exec chmod 755 {} \;
uhunix2:~/tmp% find hw3 -type f -exec chmod 644 {} \;
uhunix2:~/tmp% find hw3 -name "*.sh" -exec chmod 755 {} \;

Build

The applet is available in compiled form in the hw3/applet directory, but it is also possible to rebuild it from the source code. To rebuild it, simply go to the hw3/project directory and execute the build.sh shell script.

uhunix2:~/tmp/hw3/project% ./build.sh

This will produce a file named RoombaApplet.jar in the project directory (next to the build.sh shell script). This is a java archive of the files produced in the bin folder. The RoombaApplet.jar file is the only file needed to execute the applet, but to host it on a web server, an HTML file must also be installed. This is described in the next section.

If this does not work, ensure the correct java compiler exists in your path. On uhunix2, the java compiler is located here:

uhunix2:~/tmp/hw3/project% which javac jar
/bin/javac
/bin/jar

The JDK installed on uhunix2 is:

uhunix2:~/tmp/hw3/project% javac -version |& grep 1.5
javac 1.5.0_10

If all else fails, contact me and describe the problem you are having. I do not have much experience working with UNIX, but I will do my best to assist you.

Install

To install a java applet on a web server, you need an HTML file that displays it. I have provided one possible HTML page. It uses javascript to automatically resize the applet to the size of the web browser window. This file is located in the hw3/applet directory and is named index.html.

To host the applet on the web server, you must create a directory in your public_html folder and copy the applet and the HTML file into it. For example, if you want to install the applet to a URL such as http://www2.hawaii.edu/~sugihara/yucheng-hw3/, follow these instructions.

uhunix2:~/public_html% mkdir yucheng-hw3
uhunix2:~/public_html% cp ~/tmp/hw3/applet/index.html yucheng-hw3/
uhunix2:~/public_html% cp ~/tmp/hw3/project/RoombaApplet.jar yucheng-hw3/

Because the web server executes from a different account, you must be sure to set the appropriate file permissions so the web server can read these files and directories.

uhunix2:~/public_html% chmod 755 yucheng-hw3
uhunix2:~/public_html% chmod 644 yucheng-hw3/*

At this point, it should be possible to use a web browser to view the applet at the URL http://www2.hawaii.edu/~sugihara/yucheng-hw3/.

It is also possible to view the applet on my web site. It was built following this same procedure.

http://www.jade-cheng.com/uh/coursework/ics-311/assignment-3/implementation/applet

Links

Valid HTML 4.01 Valid CSS