...
You need to create a subdirectory called funList
and move IntList.java
into it. The full class name for IntList
is now funlist.IntList
.
Reopen the file in the funList
subdirectory. Now compile again. You should get error messages saying it can't find class IntListVisitor
and class ConsIntList
this time. You will need to package all the other classes/intefaces and move them into appropriate subdirectories.
...
- 2. In !DrJava, use the menu Project/New to create a DrJava project, save it as
listVisitorProj
ListVisProj
inside oflab10
. A dialog window will popup asking for the Project Root, Build Directory and Working Directory, etc.
Set the project root directory lab10, the build directory to lab10/ bin
and working directory to lab10/ src
. Click OK and now we have an empty project file called {{ListVisProj.drjava }} saved in xml format. Take a look at the subdirectory lab10 to see what's there.
- 3. To add the whole
funlist
package to the project, use the File/Open Folder and select the foldersrc
(and be sure the check the Open folder recursively checkbox). All the java files infunlist
should be displayed. Save the project. Compile the project by clicking on the Compile Project button. Everything should compile. Check the subdirectory bin to see all the class files generated by the compiler.
Now let's write a list visitor to compute the length of a list and add it to the project.
...
Save it in a subdirectory of funlist
called visitor. The full class name for GetLength
and GetLengthHelp
are now funlist.visitor.GetLength
and funlist.visitor.GetLengthHelp
, respectively. Note that GetLength
is public
while GetLengthHelp
is package private
. Now try to compile it! You will see a few error messages. Fix the errors until everything compiles.
...