/users/rlr/RePast/Demos-2/heatBugs/notes.txt -------------------------------------------- Here is how I set this demo up in my own file space, using ant as my "make" program. 1. Make a directory for the root directory of the model mkdir /users/rlr/RePast/Demos-2/heatBugs/ 2. Make a src and classes directory in that directory: cd /users/rlr/RePast/Demos-2/heatBugs/ mkdir src classes 3. Take a look at any of the *.java source files for the project you are setting up and find out the package name for the project. The line that looks like this will tell you what the package name is: We'll be copying the Repast demo bugs (heatBugs): /appl/repast/repast2.2/demo/heatBugs/readme and the distributed source is at /appl/repast/repast2.2/demo/heatBugs/src/uchicago/src/repastdemos/heatBugs so do this grep package /appl/repast/repast2.2/demo/heatBugs/src/uchicago/src/repastdemos/heatBugs/HeatBug.java to see package uchicago.src.repastdemos.heatBugs; We will change that to package heatBugs; after we copy over the files. So...make the directory src/heatBugs mkdir src/heatBugs/ 4. Now copy the heatBugs source files over to this directory: cp /appl/repast/repast2.2/demo/heatBugs/src/uchicago/src/repastdemos/heatBugs/* src/heatBugs ll src/heatBugs Now change the package lines mentioned in step 3: package uchicago.src.repastdemos.heatBugs; to just be: package heatBugs; in all the java files in src/heatBugs/ which you can see with the ll command: badger-heatBugs$ ll src/heatBugs/ total 36 -rw-r--r-- 1 rlr car 7671 Jan 8 08:46 HBNoGui.java -rw-r--r-- 1 rlr car 7334 Jan 8 08:46 HeatBug.java -rw-r--r-- 1 rlr car 10764 Jan 8 08:46 HeatBugsModel.java -rw-r--r-- 1 rlr car 4877 Jan 8 08:46 HeatSpace.java To confirm you made all the changes, use a grep command: badger-heatBugs$ grep "^package" src/heatBugs/*.java src/heatBugs/HBNoGui.java:package heatBugs; src/heatBugs/HeatBug.java:package heatBugs; src/heatBugs/HeatBugsModel.java:package heatBugs; src/heatBugs/HeatSpace.java:package heatBugs; 5. Copy over the build.xml file into the root project directory: cp /appl/java/CSCS/buildxml/build.xml . This ant build file should work with any repast model set up in this way. There are a few things that need to be changed in the build file (all of these are in the first few lines of the build.xml file): a. the project name needs to be changed. change the line: and substitute in the project name for the project you are creating. In this case, change to HeatBugs b. the package name needs to be changed. change the line: and change the value for packageName to the package name from step 3. c. the name of the model source file needs to be changed. change the line: and change the value to the name of the model file in the source directory (i.e., in src/heatBugs/ ) 6. After doing this, you can use ant to compile and run the project. The ant commands for this buildfile are: a. To compile the project simply type this in the project root directory: ant You should see something like: badger-heatBugs$ ant Buildfile: build.xml compile: [javac] Compiling 4 source files to /users/rlr/RePast/Demos-2/heatBugs/classes all: BUILD SUCCESSFUL b. To run the project simply type this in the project root directory: ant run You should see this in the command window: badger-heatBugs$ ant run Buildfile: build.xml compile: run: and the GUI for the model should pop up. See the online Repast docs for more information about the heatbugs demo. (Its bascially the same as the Swarm HeatBugs demo.) That's it! ------------------------------------------------------------------------------