structure
package. What is this about?
In addition to downloading the element
package, you
should also download a copy of the structure
package as
well. This package provides a number of routines that support
input and output in a portable manner. You can get the
structure
package from http://www.cs.williams.edu/~bailey/JavaStructures.
This package is also used in the CS2 course supported by the book Java
Structures.
element.zip
file?
The zip
file should be left as it is, and not unzipped.
Java stores class files in zip
files to form packages.
When you set up your environment, you should include the
zip
file in your CLASSPATH, or if you are using an
environment, such as Code Warrior, you should include the
zip
file in the project.
import
statements to find the classes from the package. Why?
On systems where CLASSPATH must be set, remember to add
the zip file to the CLASSPATH directly. If absolutely necessary
the class files may be unzipped from the package and placed in a
directory
named element
. The parent directory to the
element
directory should be included in your CLASSPATH.
The zip
file formats are far more efficient because
fewer files must be opened during the import.
If you're using the CodeWarrior system from MetroWerks, you will find instructions for creating libraries (jar files) here.
If you're using the CodeWarrior system from MetroWerks in classes, you will find instructions for creating stationery that makes use of the library jar files here.
ConsoleWindow
?
First, if the window is very small, you may have an outdated version of the element package. There are problems on Windows machines using Sun's environment (javac). Pick a new distribution and try that out.
Otherwise, use the constructor for the console window that takes the size
as parameters. Here's the example usage:
import element.*;
public class test
{
public static void main(String[] args)
{
ConsoleWindow c = new ConsoleWindow(50,80,"Try this");
for (int i = 0; i < 50; i++)
{
c.out.println(i);
}
}
}