How to integrate ONE with Eclipse?

Hai all,

After being familiar with the ONE simulator you may wish to start coding in it. So editing programs in notepad cannot be easy. You may want to integrate ONE with eclipse and then execute the programs. This article gives steps to integrate ONE with eclipse.
The steps are given below with some screenshots:
1.      Open eclipse and go to File -> New -> Java Project

2.      Give the project name whatever you like. I prefer it to be ONE as that is the name of the simulator.
3.      Now you will see a folder named ONE on the left side in package explorer.
4.      Open this folder and there will another folder named ‘src’. Right click on src and click on ‘Import’ option. U will be directed to a box as shown in the picture below.

5.      Click on the first option ‘File System’ and click next. You will be redirected to another box as shown below.

6.      In the text field ‘From directory’, browse the path where your ONE folder is stored.
7.      Click on the checkbox that appears in the left side. This will select all the folders and files in the one_1.4.1.

8.      Now click Finish button at the bottom.
9.      The src folder will contain all the one_1.4.1 contents. But there will be a red cross mark on the src folder. This is because eclipse does not get path to some libraries used in the ONE simulator. We have to manually add this.
10.  For this right click on the project folder. Go to Build Path -> Add External Archives.

11.  Go to one_1.4.1 -> lib and select both jar files in it.

12.  Now you will be able to see referenced libraries along with JRE system libraries.

You may still see cross mark over the src folder. To eliminate this, either delete the test folder in src or add junit.jar (to be downloaded from Internet) in the Referenced libraries.

In order to set the default path to the project folder (optional) do the following
1. Click Run -> Run Configurations 

2. Click the Arguments tab
3. Click 'Other' instead of 'Default' and set path to src by clicking on the workspace button. Now it must look like '${workspace_loc:Project_name/src}'

4. Click Apply 
Now run the DTNSim.java in the core folder. Your project will run with 'default_settings.txt' as the settings file.

Now to use cmd in eclipse:

1. In the Eclipse tool go to Run -> External Tools -> External Tools Configurations option.
2. Click New Launch Configuration option in Create, manage and run configuration screen
3. Provide configuration details of the Command Prompt in the Main tab
                   1. Name: <<Give any name to your configuration (Here it is Command_Prompt)
                   2. Location: <<Location of the CMD.exe in your Windows>>
                   3. Working Directory: <<Any directory where you want to point the Command prompt>>                                  (Make this location to the project folder, eg: C:\workspace_loc:Project_name/src)
                   4. Tick the check box Allocate console. This will ensure the eclipse console is being used as the command prompt for any input or output. (this is optional)
                   5. Click Run.
Hope the article helped you...

Comments

  1. Hello NiKhitha,

    Thank you, but i have a question, about create java programs to create my DTN application, after is should add the external library to run in the one environment?

    ReplyDelete
  2. Martina,

    Can you make your question a little bit more specific?

    Nikhitha

    ReplyDelete
    Replies
    1. as i m new to ONE simulator using eclipse i could'nt understand below step

      Now run the DTNSim.java in the core folder. Your project will run with 'default_settings.txt' as the settings file.

      Delete
  3. Hey,

    I was trying to integrate One Sim with Eclipse. However I got stuck on the last step which is Running DTNSim.java in Eclipse.

    I get this error on the console :

    Can't start: error in configuration file(s)
    Can't find setting 'Scenario.nrofHostGroups'

    However, in my default_settings.txt, this setting is already present.

    Need some help. Please.

    ReplyDelete
  4. Same problem here... Has anyone come up with a solution yet ? Thanks

    ReplyDelete
  5. I had the same problem. The solution is to copy default_settings.txt scenario or any other scenario that you want to run to your root folder of your Project into workspace. Cheers.

    ReplyDelete
  6. Cheers k se sena re Fani :-P. A re papapetrou ti mas ekanes m aftes tis mparoufes xaxaxaxa

    ReplyDelete
  7. Another solution is set the argument to "${string_prompt}" in run confiurations of your simulation. After run just put the localization of your settings file.

    ReplyDelete
  8. Guys if u r still stuck in getting this error:
    " Can't start: error in configuration file(s)
    Can't find setting 'Scenario.nrofHostGroups'"
    try to specify and import the One-1-4-1 folder (or any version u r using) when u r creating a new java project. in the new project dialog box, after naming yr project press next instead of finish and browse for one-1-4-1 folder.
    i think this error might be related to losing "default_settings.txt" when u import folder in the src.
    hope this works.

    ReplyDelete
  9. I'm getting a warning on 67 items! can anybody help? should I keep it that way?

    ReplyDelete
  10. Hi! Useful tutorial...but ONE does not have any provision for encrypting messages exchanged between nodes. I need some help encrypting messages in DTN. I am really stuck.. please help

    ReplyDelete
  11. hello.. how do i run the project that i had downloaded from the ONE simulator page.. for example the Scorp project

    ReplyDelete
    Replies
    1. Hello,

      This should be very simple. For example in the case of ur SCORP project you will be able to find these folders inside the package:

      core, input, report, routing and Sample. Copy the files from these folders and replace them in the respective folders in ONE folder.

      For example inside core folder of the SCORP package you will see four files: DTNSim.java, Message.java, SimScenario.java and SlotTimeCheck.java. Copy these and place them in the ONE/core folder.

      I would recommend keeping a backup of the original versions of these files like DTNSim.java etc somewhere else with you. (Some files like SlotTimeCheck.java are specific to this project and so you will not find them in any folders in ONE).

      Hope this helped you!!!

      Delete
    2. Thank you for your respond. I really appreciate it. However, i failed to integrate the ONE with Eclipse. I found this error. Can you help me out. Thank you. Hope to hear from you soon.

      Exception in thread "main" java.lang.Error: Unresolved compilation problem:
      The method format(String, Object[]) in the type String is not applicable for the arguments (String, double)

      at core.DTNSim.main(DTNSim.java:88)

      Delete
  12. if u get this error
    //
    Can't start: error in configuration file(s)
    Can't find setting 'Scenario.nrofHostGroups'
    //
    then set run configuration as describe above

    1. Click Run -> Run Configurations
    2. Click the Arguments tab
    3. Click 'Other' instead of 'Default' and set path to src by clicking on the workspace button. Now it must look like '${workspace_loc:Project_name/src}'
    4. Click Apply
    Now run the DTNSim.java in the core folder. Your project will run with 'default_settings.txt' as the settings file.

    ReplyDelete
  13. sorry I'm a newbie.
    If I want to create a scenario from the beginning, the movement of a node and sending the package to the nodes. I have to work from where to make it? Thank you. Anyone have an email or social media accounts that could be contacted further if I want asking again? thanks again.

    ReplyDelete
  14. i am working on geospray routing protocol of vdtn using one simulator. can anyone please help with the coding ?

    ReplyDelete
  15. I tried this
    1. Click Run -> Run Configurations
    2. Click the Arguments tab
    3. Click 'Other' instead of 'Default' and set path to src by clicking on the workspace button. Now it must look like '${workspace_loc:Project_name/src}'
    4. Click Apply

    but it shows an error.

    it said 'Launching New_configuration' has encountered a problem

    Variable references non-existent resource :
    ${workspace_loc:Project_name/src}

    i am using eclipse luna ..
    please help me..

    ReplyDelete
  16. I have tried all the methods mentioned above to solve this

    Can't start: error in configuration file(s)
    Can't find setting 'Scenario.nrofHostGroups'

    Supposedly none of them is working.
    A little help here to solve this glitch.
    Thankyou

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. i am integrating ONE with eclipse. i delete the test folder in the src but red cross still appear on all files. i also try to remove this by downloading junit.jar file but nothing happens.
    Please help!!

    ReplyDelete
  20. Top 6 casinos to play on real money online - DrMCD
    Play real money slot machines. These machines come in various 영주 출장샵 denominations 오산 출장마사지 and can 김해 출장안마 range from 경상남도 출장안마 traditional slot machines to 고양 출장샵 video poker machines. In the

    ReplyDelete
  21. Hi Nikhita. Thanks a ton for this tutorial. It helped me a lot! But i'm facing issues like how can i run for example Spray and wait routing protocol. Some existing routing protocols are there in the simulator but how to run them? Can you please tell me. Thanks in advance.

    ReplyDelete

Post a Comment

Popular Posts