Java: First Contact

Roger Garside and John Mariani, Computing Department, Lancaster University

Course Technology / September 1997 / ISBN 1-85032-316-X
46.65 US dollars / 21.95 pounds sterling

Classes

The "java.lancs" package used in the examples and exercises in the "Java: First Contact" book contains eight classes:

Person
BasicIo
Card
BasicGraphics
GroupOfPeople
BasicFileIo
OutDate
WordFile

This site contains for each class a source file (for example "Person.java" for the "Person" class: a total of eight files) and one or more bytecode files (such as "BasicShape.class", "BasicCanvas.class" and "BasicGraphics.class" for the "BasicGraphics" class: a total of ten files).

You can download each file individually, or download a Unix zip file containing all the files mentioned (including this one).

You can obtain a PC version of the java.lancs package, together with a copy of the example files from the book, from the Course Technology Web site

This is what you should do to make use of the "java.lancs" package:

(0) You should first set up your Java environment (for example the JDK or Java Development Kit) - this needs to be Java 1.1

(1) decide where you are going to put the code for the package - for example we have it in a directory "classes" with path name "/usr/local/java/classes".

(2) in this directory create a directory called "java", and in that create a directory called "lancs" - this final directory would in our case have the path name "/usr/local/java/classes/java/lancs"

(3) set up the bytecode files in this final directory. You can do this in one of two ways:

(3)(a) copy all the bytecode files into this directory. There are ten files, as follows:

BasicCanvas.class
BasicFileIo.class
BasicGraphics.class
BasicIo.class
BasicShape.class
Card.class
GroupOfPeople.class
OurDate.class
Person.class
WordFile.class

or

(3)(b) copy all the source files into the directory. There are eight files, as follows:

BasicFileIo.java
BasicGraphics.java
BasicIo.java
Card.java
GroupOfPeople.java
OurDate.java
Person.java
WordFile.java

Then compile each one in turn to create the bytecode file(s) - for instance:

javac Person.java

You should end up with the ten "...class" files listed above.

(4) set up the documentation (the "API") in a suitable directory (we have it in a directory with path name "/usr/local/java/api"). You can do this in one of two ways:

(4)(a) by copying from this site all the HTML files. There are twelve of them, as follows:

AllNames.html
Package-java.lancs.html
java.lancs.BasicFileIo.html
java.lancs.BasicGraphics.html
java.lancs.BasicIo.html
java.lancs.Card.html
java.lancs.GroupOfPeople.html
java.lancs.OurDate.html
java.lancs.Person.html
java.lancs.WordFile.html
packages.html
tree.html

or

(4)(b) by going into the directory in which you want the API to appear and calling the "javadoc" program supplied as part of the JDK:

javadoc java.lancs

You must have the CLASSPATH (see step 5) set up for this to work. You should end up with the twelve "...html" files listed above.

You can access this API by pointing your browser at the file "packages.html".

(5) You need to have an environment variable "CLASSPATH" set up to refer to the place where you have put the package code - since we have set it up on a Unix machine in the "classes" directory with path name "/usr/local/java/classes", we have the command:

setenv CLASSPATH .:/usr/local/java/classes

on a Windows 95 system we have the command:

SET CLASSPATH=C:\usr\local\java\classes


Return to main page

last updated: 3rd February 1998