Running the MBS Case Study with Eclipse 3.0
Cay S. Horstmann
Note: This document is now rather outdated. For an updated version,
please see http://webclass.superquest.net/apjava/Eclipse/eclipse_3_1_MBCS_Setup.pdf
Background
Eclipse is a popular integrated
development environment for Java programming. You may find this Eclipse tutorial helpful, particularly if you use Big Java or Java Concepts.
The Marine
Biology Simulation Case Study is used in the AP
Computer Science exam. Its purpose is to give students an opportunity
to study a program of significant complexity, and to provide a shared
background for exam questions.
This note explains how to run the MBS Case Study in the Eclipse
environment.
File Preparation
- Download the file JavaMBS.zip.
- Unzip the file. If you unzip it in c:\, the data are saved in the
c:\JavaMBS subdirectory.
(Under Linux, use something like /home/yourname/JavaMBS. In the
following, I assume that you can set up a directory structure that works
for your environment.
Eclipse Preparation
You will create a special Eclipse project whose sole purpose is to be
the basis of other projects. This initial step greatly reduces the tedium
of configuring the source and JAR files for each MBS project.
- Start Eclipse
- Select File -> New Project
- Select Java
- Click Next
- Supply the Project name
MBSLibs
- Uncheck the Use default
checkbox
- Set the directory to "c:\JavaMBS\Code". (Change the directory name
as appropriate for your installation. The screen shot below shows the
Linux directory /home/cay/JavaMBS/Code.)

- Click Next
- Click on the Source tab
- Select MBSLibs/DynamicPopulation
- Click on Remove
- Click on the Libraries tab

- Click the Add JARs
button.
- Add both mbsbb.jar and mbsgui.jar

- Click on the Order and
Export tab
- Check mbsbb.jar, mbsgui.jar.

- Click Finish
Making a MBS Project
Follow these steps for each new project that you want to run. You would
make a new project
- for running each of the simple demos (SimpleMBSDemo1.java, SimpleMBSDemo2.java)
- for experimenting with the GUI program (MBSGUI.java)
- whenever you make a change to some of the files (e.g. to change
Fish.java)
Here are the steps required to make a new project.
- Select File -> New
Project
- Select Java
- Click Next
- Supply a Project name such
as simple1. If you are
happy with the default directory, you can leave the Use Default checked. Otherwise,
uncheck it, and specify your own directory. It will be created for you
if it doesn't exist.

- Click Next
- Click on the Projects
tab
- Check MBSLibs

- Click on Finish
- Select File ->
Import
- Select File System
- Click Next
- In the From directory field,
type c:\JavaMBS\Code
- In the window to the left and below, click on the Code label, but do not check the check box
- In the right hand side pane, select those files that you need for
your project. You will need the class with the main method (such as SimpleMBSDemo1.java, SimpleMBSDemo2.java, MBSGUI.java) and any classes that
you intend to modify (such as Fish.java in later stages of the
case study).

- Click on Finish
- Compile your project: Project ->
Rebuild All. (Ignore any error messages that you get regarding
the Fish class in the
- In the Package Explorer
window, open up the project until you see the class with the main method (such as SimpleMBSDemo1)

- Run your project: Run -> Run As
-> Java Application

- Congratulations! Your project is running.
