Setting-up Cooja in Linux Machine

Step by step guide to installing Cooja simulator

Introduction

Cooja is a java-based wireless sensor network simulator distributed with Contiki.

It allows the simulation of different levels from physical to application layer, and also allows the emulation of the hardware of a set of sensor nodes and this is why it is widely used in field of IOT.

This is a step-by-step guide to install Cooja in your linux system.

Set-up

Cooja works well only with Java 8 as Java has removed javax.xml.bind module from its higher version jdks. Install it in your linux system using command :

sudo apt-get update
sudo apt-get install openjdk-8-jdk

Set environment variables for java and point them to location where java is installed. Example :

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${PATH}:${JAVA_HOME}/bin

Check whether Java installation and environment variable setting is successful :

FYI 1. Make sure git is installed in your system.

FYI 2. /home/weasel/Installed/ is my base directory for software installation.

  • Clone ContikiOS from github into any directory (contiki in my case) using command :

git clone git://github.com/contiki-os/contiki.git contiki

git clone git://github.com/contiki-os/contiki.git contiki
git clone git://github.com/contiki-os/contiki.git contiki
  • If you directly run Cooja without downloading submodule code, you will run into an error as MSPSim simulator code is not downloaded at this point (you can verify this by going inside folder /contiki/tools/mspsim/). Error that you will get :
  • To download this dependency code, get into desired cooja folder : contiki/tools/cooja and download submodule code for MSPSim using command :

git submodule update — init

  • At this point you are all set up to get started.

From inside contiki/tools/coojadirectory, run command

ant run

This marks end of the installation guide for Cooja. Now you are ready to start with your Hello World!!! program.

Relevant Reads

Happy Learning.

To connect with me on Linkedin click here.

Masters, NIT Surathka l Java Developer | Bachelors, IIIT Jabalpur

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store