Running ONE Simulator in Eclipse Part 2

In the first part of this series we discussed how to download, configure and Run ONE Simulator. In this part we are going to see how we can work in this simulator in Eclipse. This has been tested on Linux and Windows.

Eclipse Installation

Linux Users (For the Serious folks)

For Linux user, best way is to open Software Center (if you are using Ubuntu) and search for Eclipse, and install it.

Windows Users (Part time Users)

For Windows users, download Eclipse from eclipse.org website. Once Downloaded extract the compressed archive in any root drive, e.g C D. Once uncompressed, double click eclipse.exe to launch Eclipse.

If eclipse doesn't launch or it throws and error, check your Java installation. If you have installed Java 32 bit version then download the 32 bit eclipse, if you have installed 64 bit java, then download 64 bit eclipse.


Creating a Project in Eclipse

Click on File -> New -> Java Project. 

A Window will open. 

Give it any Name, i gave it the name ONESimulator. Click on Next and then click on Finish. 

The Project will open, on the left hand side you will see a window with the project ONESimulator. 

Click on the Project and you will find an src folder inside it. 

Right Click on the src and select 'Import' Option. You will be see a box like this 

 Select File System Option and click Next, you will be presented with another window. 



Click on Browse, And Find the ONE Simulator Folder that you downloaded in the First Part of the Series. 

Or you can download it from https://www.netlab.tkk.fi/tutkimus/dtn/theone/  . Download the latest version, unzip it.

Select the ONE Simulator Folder


Click on the Check box on the Left Hand Side and then Click Finish. This Imports all the resources (Class Files/Jars) from the one_14.1 folder into your current project. 


Now you will see all the folders of the ONE simulator project in your Eclipse. 

But Hang on, you will also see a cross sign on the src folder icon. This means Eclipse cannot resolve all the libraries being referenced by ONE simulator. These libraries have to be included manually. 

Follow the below steps to add the libraries. 

1) Within Eclipse, Right Click on the Project Folder i.e the Folder over the src folder. Go to Build Path -> Add External Archives. Go to the ONE Simulator Folder, (that you extracted) and open the lib folder, and select both the jar files present in the folder. 

2) Right Click on the test folder within the src folder and delete it.


Running the ONE simulator

Important: Copy default_settings.txt and data folder to the Root Folder of your Eclipse Project. Without this it will not work 
 
For me there was no other need, Just Right Click on the Project folder Select Run As -> Java Application, and a window will open 

Select DTNSim - core and main window will appear.. 



Compiling and Running ONE Simulator under Linux

ONE simulator stands for Opportunistic Network Environment. It is a network simulator developed in Java. In this blog i will show how to compile and run ONE simulator from source in Linux. For this purpose i am using Ubuntu 14.0.4 trusty. Although the steps should be similar in any distribution of Linux, still it is better to know which version of Linux are you using.

So launch the terminal and issue the following command.

$ lsb_release -a


You should have Java Installed on your Machine. Find if java is installed on your computer by firing the following command on your terminal

$ which javac

It should tell you the location where java is installed like the one in the screen-shot


If it doesn't show the path, it either means that you don't have java installed, or java is not in your path.

You can install Java by issuing the following command.

$ sudo apt-get install openjdk7-jre

This will install java.

Now once again issue the command

$which javac

It should tell you the path of the java.

Step2 Download ONE Simulator by issuing the following command


$ wget https://www.netlab.tkk.fi/tutkimus/dtn/theone/down/one_1.4.1.tar.gz

 Step 3 Extract the archive. 


$ tar -xvf one_1.4.1.tar.gz 

Change Directory

$cd one_1.4.1

Compile the source by issuing the following command

$ ./compile.bat

If everything goes right, you will have the compiled source.

Step 4 Run the One Simulator 


$ ./one.sh 

The One simulator window should be displayed.







Force PHP to display Errors

At the top of your page add the following.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
 
?> 
 
 

Running Drupal in Docker

I will assume that you have already installed docker. If you haven't installed docker please visit https://www.docker.com/ to download a...