Thursday, January 5, 2012

Integrating PeerSim ( P2P Simulator) with Eclipse

In this article I will explain how to integrate PeerSim with Eclipse IDE .
I am using peersim version 1.0.5 and Eclipse Helios IDE

Step 1: Download peersim-1.0.5 and extract it in a folder you like . Say the downloaded zip file was saved in C:\My Documents\Downloads. Extract it here and you will find a folder named peersim-1.0.5 .


Step 2: At first create a JAVA project . ( Go File -> Project -> JAVA Project )
Step 3: In window that popped up , unmark the option Use default location. A text box will be alive and show there the directory where peersim-1.0.5 was extracted . According to Step 1 that should be C:\My Documents\Downloads\peersim-1.0.5


Step 3: Press next to see everything is included correctly .


Step 4: Right Click on project name in the project explorer. Select Build Path -> Configure Build Path . In the window that popped up ,select the Libraries tab . Remove the jars named peersim-1.0.5.jar and peersim-doclet.jar.

Step 5: Right Click on project name in the project explorer. Select Run as -> Run Configuration. In the explorer at the left double click on JAVA Application.You will see a new run configuration window is on the right. Give any name you like at the Name field. Hit  Search to find the main class.
The class name is Simulator under peersim package.

Step 6: Go to the Arguments tab. In the program arguments field input "example/config-example1.txt". The press Run. That will simulate a protocol configured in the example/config-example1.txt file.

There are also some other configuration files in the "example/" directory . Change in the "Argument" tab to check the others.