Setting-up Cooja in Linux Machine

Nitin Sharma
3 min readOct 16, 2020

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

Step 1. Install Java

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 :

Step 2. Setup Cooja

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
  • 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.

Step 3. Run Cooja

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.

--

--

Nitin Sharma

Masters, NIT Surathkal | Java Developer | Bachelors, IIIT Jabalpur