6.1.2 用eclipse环境调试一步一步学repast操作

1,156 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,156
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

6.1.2 用eclipse环境调试一步一步学repast操作

  1. 1. Building the CarryDrop simulation in Eclipse Creating a new project with existing code from John Murphy’s RePast tutorial
  2. 2. Preparation <ul><li>For these slides you will need: </li></ul><ul><ul><li>The Eclipse IDE installed and running. </li></ul></ul><ul><ul><li>Access to the source code from John Murphy’s RePast tutorial , step 14 . </li></ul></ul>
  3. 3. Creating a new project <ul><li>Start Eclipse </li></ul><ul><li>Go to File -> Project </li></ul><ul><li>In the New Project dialog box select “Java Project” and hit the Next button </li></ul><ul><li>In the next screen, name the project and choose a location. </li></ul><ul><li>Leave the default setting for the project layout. </li></ul>
  4. 4. Creating a new project cont. <ul><li>Add RePast to the build path under the “Libraries” tab. </li></ul><ul><li>Click the “Finish” button. </li></ul>Please refer to Installing Repast in the Eclipse IDE under section IV.B of the RePast Study Group homepage for details on adding the RePast jar to a project build path.
  5. 5. Creating a new class <ul><li>Now that we have the project established we can add the first new class. </li></ul><ul><li>Go to File->New->Class. </li></ul><ul><li>A New Class window should appear. </li></ul><ul><li>For the Package, enter “demo” </li></ul><ul><li>For Name, enter CarryDropModel. </li></ul><ul><li>Leave all other settings at default values. </li></ul><ul><li>Hit the “Finish” button. </li></ul>
  6. 6. The first class: CarryDropModel <ul><li>Go to step 14 of Murphy’s tutorial. </li></ul><ul><li>In your browser, select all the Java code for the CarryDropModel class and go to Edit->Copy </li></ul><ul><li>In Eclipse, select all the pre-written code in the new CarryDropModel </li></ul>
  7. 7. The first class: CarryDropModel <ul><li>Go to Edit->Paste. </li></ul><ul><li>The code from the tutorial webpage should have now replaced the pre-written code. </li></ul>
  8. 8. Adding the other classes <ul><li>Save the CarryDropModel in Eclipse and it is done </li></ul><ul><li>Repeat the previous steps to create new classes, copy code from the tutorial, and paste it in Eclipse for both CarryDropAgent and CarryDropSpace. </li></ul><ul><li>The CarryDrop simulation is now in Eclipse and ready to be run. </li></ul>
  9. 9. The CaryyDrop simulation <ul><li>To start the simulation, go to Run->Run… </li></ul><ul><li>In the Run dialog box CarryDropModel, </li></ul><ul><ul><li>make sure the Project name is correct </li></ul></ul><ul><ul><li>the Main Class box has demo.CarryDropModel </li></ul></ul><ul><li>Hit the “Run” button </li></ul>
  10. 10. The CarryDrop Simulation <ul><li>RePast will start </li></ul><ul><li>Press the Initialize button </li></ul><ul><li>The CarryDropModel window will appear with the initialized money space. </li></ul>

×