top
![[Texas PLT logo]](images/logo.gif) |
COMP 202: Principles of Object-Oriented Programming II
←
DrJava Project Facility
→
|
DrJava's Project facility allows the developer to organize
their work into a cohesive unit. It allows the developer to
- Manage multiple files and multiple packages easily
and effectively
- Distinguish between files that are part of a
particular piece of work, separate from other files used for reference.
- Separate compiled from non-compiled code.
Creating a Project in DrJava
- First create a directory that will hold all the code
and supplemental materials for your project. Use a folder name that is
relevant to the project.
- Below that directory, make two subdirectories:
- src --
holds all the Java source files. Put any existing source
code you have in here. If the code is in a package, then put the
entire package directory here.
- classes --
holds all the compiled class files.
- Start DrJava and select Project/New...
- Save the project in the project folder you created,
using an appropriate name.
- Go to Project/Project Preferences and set the
Build Directory to be the classes
directory you made above.
- If you know what class holds the
main() function, set the Main Document
field to that class in the src
directory.
- Go to File/Open Folder... and open the
src directory. This will
bring in any existing code that you have.
Adding a File to the Project
- Add a file to the project using File/New... or the
speed button as usual. The file will be added to the project
when it is saved with a name.
- The same applies for new unit tests.
Compiling the Project
- Under the Project menu, select Compile
Project to compile everything in the project or Compile Open Project
Files to compile just the files that are open.
- The Compile All speed button compiles all
files whether or not they are in the project.
Testing the Project
- Under Projects, select Test Project.
Clearing the compiled files
This feature is useful when zipping up project
directories when you don't wish to include the compiled class files.
- Under Projects, click on Clean Built
Directory. This will erase all files in the
classes folder.
←
DrJava Project Facility
→
URL: http://www.cs.rice.edu/~javaplt/mgricken/teaching/202/08-fall/info/drjavaproject.shtml
Copyright © 2008-2010 Mathias Ricken and Stephen Wong