Integrating PeerSim with Eclipse

PeerSim, if you don’t know it, is a famous P2P networks simulator, written in Java. You can find its home clicking this link.

Surely, when you are writing in Java, it’s convenient to use Eclipse. In this article I will talk about how to configure eclipse to work with PeerSim. I decide to write this article mainly because I’ve founded some articles that talk about this integration; but I disagree with their solutions.

#
 
Download PeerSim

First of all, you need to download the PeerSim package from Sourceforge.

Extract the package and then you will have a folder called peersim-1.0.5, that contains all the PeerSim files. You can put this folder wherever you want, for example in your home directory.

#
 
Project Configuration

Create a Java Project going to File -> New -> Java Project.

Then, with the right button, click on the project name that you can find in the projects list (Package Explorer). Hence, open the properties of the project, and go to the Java Build Path form and open the Libraries tab. In this way you can include the libraries of PeerSim.

To do that, click to Add External JARs, and navigate until you reach the PeerSim folder that you extracted before. Select the following libraries:

  • peersim-1.0.5.jar
  • jep-2.3.0.jar
  • djep-1.0.0.jar

Now, to import the documentation, expand the relative entry of the PeerSim library.

Double click on the documentation entry, and in the window that will appear, click to Javadoc URL, and then to Browse, navigate again until you reach the PeerSim folder, and select the “doc” folder that you will find inside.

#
 
Configure for Run

To configure PeerSim, to run a simulation, open the run configuration window going to Run -> Run Configurations. Now, with the right button, click the menu entry called “Java Application” and create a new configuration. Assign any name to it.

Then, in the “Main Class” section, click to Search, and select the entry called “Simulator – peersim”. It is the main class of Peersim (it is in inside the PeerSim library).

To configure the arguments to start a simulation, in a way that you can specify the configuration file path, you can open the Arguments tab, and changing the field called “Program Arguments”.

To do a fast test, you can create a folder inside your project folder, with the name “configs”. Then, you can copy in it the file “example/config-example1.txt”, that you can find in the PeerSim folder. Then, you can change the “Program Arguments” field, inserting the string “configs/config-example1.txt”.

Run, and enjoy!

10 responses to “Integrating PeerSim with Eclipse

  1. Brunna Albuquerque

    Great post! Very simple and easy to understand. It helped me a lot! Thanks for that!

  2. Aayush Gupta

    It was really helpful to me! Thanks a lot!

  3. Aayush Gupta

    can you please tell me how to integrate bittorent in eclipse. i have tried a lot but its not running

  4. SAR

    I have install the peersim depend on above instruction but when I press Run I get this message (Error: Could not find or load main class peersim.Simulator)
    Please help me to solve it

  5. A Shreyas

    Many thanks, it helped! Great work!

  6. Mourad

    succesufely installed and configured, it is very simple, good explanation, thank you,

  7. Mourad amad

    it is very easy to applied, thanks

  8. PH.Simon

    Hi,
    Very clear and easy to use.
    Thank you for your help and time spent on this.

  9. SB

    hi…
    I have configured as per the demo given.. But the error popping up is
    ” Simulator: unable to determine simulation engine type”. Please suggest remedy to this..

    Thanks in advance..

  10. Amanda

    It doesn’t work :/
    it displays “control.avgo: 2 9.573571471429428 84.38874902498048 50000 50.500000000000085 77.89385877895182 1 1
    CDSimulator: cycle 2 done”

Leave a Reply

Your email address will not be published. Required fields are marked *