To do this assignment with the
ArrayStack class you need to have downloaded the textbook code If you already did this, great. Otherwise,
download it and expand it wherever you like; I put it in my
Unlike Objectdraw, the textbook's code is package-based (see Chapter 2 for more about packages). Say you decided to use ArrayStack in this project, you'd import it this way:
To access it when compiling, add it to your Java classpath. This is the list of directories that
javac searches to find the Java libraries we use. In CS157 this was done for you, now you need to learn how to handle this stuff yourself. On the Linux computers I do this:
Of course, you'll use the path for your installation of dsjava, not mine!
(still using BlueJ? set the classpath in the same you did for objectdraw, see the first step for a reminder)
Alternatively, you can add the class path when you compile. For my installation it would look like:
javac -cp ~/Classes/CS257/Resources/dsjava Simple0.java
The downside is, you have to type that dang classpath each time you issue the compiler command.
Note: you can use the
Stack class in java.util if you'd like. Just import it with
No extra compilation hoops to jump through.