Assignment 2 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
.
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-hw2.tar.gz
First, extract the files from the tarball. This will produce a hw2
directory in the current directory and several files and directories inside of it.
uhunix2:~/tmp% gzip -dc yucheng-ics311-hw2.tar.gz | tar xf - uhunix2:~/tmp% ls -1 hw2 yucheng-ics311-hw2.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 all directories 755
permissions, all files 644
permissions, and all shell scripts 755
permissions.
uhunix2:~/tmp% find hw2 -type d -exec chmod 755 {} \; uhunix2:~/tmp% find hw2 -type f -exec chmod 644 {} \; uhunix2:~/tmp% find hw2 -name "*.sh" -exec chmod 755 {} \;
The applet is available in compiled form in the hw2/applet
directory, but it is also possible to rebuild it from the source code. To rebuild it, simply go to the hw2/project
directory and execute the build.sh
shell script.
uhunix2:~/tmp/hw2/project% ./build.sh
This will produce a file named SpanningTreeApplet.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 SpanningTreeApplet.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/hw2/project% which javac jar /bin/javac /bin/jar
The JDK installed on uhunix2
is:
uhunix2:~/tmp/hw2/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.
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 hw2/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-hw2/
, follow these instructions.
uhunix2:~/public_html% mkdir yucheng-hw2 uhunix2:~/public_html% cp ~/tmp/hw2/applet/index.html yucheng-hw2/ uhunix2:~/public_html% cp ~/tmp/hw2/project/SpanningTreeApplet.jar yucheng-hw2/
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-hw2 uhunix2:~/public_html% chmod 644 yucheng-hw2/*
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-hw2/
.
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-2/applet
Return to the main page.
View the operation/user’s manual.
View the reference manual.
View the testing documentation.