User Tools

Site Tools


Setting Up the Development Environment


The N2S3 simulator is written in the Scala programming language and built using the Scala Build Tool(sbt). We do not provide different versions or installations per different platforms (e.g., unix, windows). Platform differences are managed automatically by N2S3's dependencies. You may need to set up you Scala environment. All this boils down to installing Java (which you probably have already installed) and then installing sbt. Sbt will manage the installation of the correct scala version for N2S3 and all its dependencies. Follow the up-to-date installation instructions of Java and sbt in your own platform.

N2S3 and/or IntelliJ might not work if you're using OpenJDK11, you should use OpenJDK8 instead.

Make sure you have a good internet connection. Besides the manual installation of these packages. Some of them will also load new packages and dependencies dynamically. At the end, you should be able to test your installation by issuing the following commands in a terminal:

$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
$ sbt version
[info] Loading global plugins from /home/guille/.sbt/0.13/plugins
[info] Set current project to nessy (in build file:/home/guille/projects/N2S3/nessy/)
[info] 0.1-SNAPSHOT

N2S3's source code is managed with a GIT repository hosted within the SourceSup plaform. To load N2S3's source code you'll need to first install a git client in your machine. We suggest you follow the up-to-date installation instructions for git in your own platform.

At the end, you should be able to test your installation by issuing the following commands in a terminal:

$ git version
git version 2.1.4

In this example, I have installed sbt version 0.1-SNAPSHOT, git version 2.1.4 and Java version 1.7.0_95.

A Note to Windows Users

Some parts of N2S3 such as the tests or the examples make usage of resource files. On windows, files may not be found if there are spaces in the path where you installed N2S3. Try avoiding spaces in the installation path of N2S3 to avoid such misbehaviours.

E.g., avoid

'C:\my path\to n2s3 experiments\'

Get the code

N2S3 is so far distributed with it's code repository in the source code force sourcesup. Latest stable versions of N2S3 are published in the master branch of the git repository of the forge. To get the latest's N2S3 version, you can issue the following command:

$ git clone

This will create a n2s3 directory right where you executed the clone command. Alternatively, you can tell git the name of the specific directory where you want it to load the code:

$ git clone targetDirectory

Once the git clone command is finished you'll see that a directory structure similar to this was created (this may change depending on the version):

n2s3/ #or targetDirectory

Finally, you can tell sbt to compile n2s3. You'll notice that sbt starts downloading libraries from the network. These are sbt and n2s3 dependencies and they will be loaded just once. Afterwards sbt will cache them and reuse them.

$ cd n2s3
$ sbt compile

Ensure Everything Went ok

To ensure that the installation of N2S3 is correct, you can run the tests. N2S3 is distributed with a set of unit and integration tests that aim to ensure the health of N2S3's code. To run N2S3's tests from the command line, you can use sbt:

$ sbt test

SBT Integration

N2S3 is constructed as an SBT project. SBT allows the management of dependencies and simplifies common development tasks such as building, testing and packaging the system.

N2S3 is organized as an SBT multi-project, as explained in Inside the N2S3 project, there are several sub-projects:

  • n2s3: The simulator core
  • examples
  • n2s3 daemon: a daemon for distribution
  • integration tests

Because of this, the source code is organized with a particular directory structure:

  |---build.sbt (main sbt configuration)
  |     |---build.sbt
  |     |---src/
  |     |---test/
  |     |---resources/
  |     |---build.sbt
  |     |---src/
  |     |---test/
  |     |---resources/
  |     |---build.sbt
  |     |---src/
  |     |---test/
  |     |---resources/

That is, the project has a main build.sbt file where the project configuration is found, and then subdirectories where the subprojects are found. Each of the subprojects may contain its own build.sbt file with specific configurations and a src folder where the main sources are found, a test folder where the unit tests of the project are and a resources folder where files such as pictures and data files for testing are stored.

IDE Integration

The sbt command line tool already helps into building, testing and packaging N2S3. However, to edit N2S3's source code, we recommend the use of an IDE. An IDE will help in navigating the code, provide incremental compilations to get faster feedback and so on. Below we describe briefly how N2S3 can be integrated with two popular IDEs: IntelliJ Idea and Eclipse Scala IDE.

A Note on Resources and IDEs

IDEs may have problems integrating with resources (used e.g., in tests and examples). Resources may not be copied to the classpath and thus an application run from the IDE may not be able to found them.

To avoid this, execute

$ sbt test


$ sbt run

at least once from the console. This makes sbt copy the resources to the class path and running from the IDE runs just fine from there.

You may repeat it every time you change your resources.

IntelliJ Idea with Scala plugin

IntelliJ Idea ( already comes with Scala and SBT support. Importing N2S3 is straight forward: just do File→New→Project From Existing Sources and select the build.sbt in the parent directory. IntelliJ will detect it is a multi-project build and propose you to load the modules of the project into the IDE. Then follow the importing wizard.

In case you want to customize your integration, you can find more information in IntelliJ site (

Be careful: Scala's incremental compilation does not follow the entire Scala specification and you may compile the entire project from time to time to ensure everything is correct.

Eclipse Scala IDE

The Scala IDE ( is a plugin on top of Eclipse adding integration to the Scala language. Scala IDE does not integrate by default with SBT. To do this integration, we should perform some previous steps:

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
  • Use the command sbt eclipse inside the project's directory

Once this is done, Scala IDE will recognize the folder as a scala project. You can import it by following the menus: File→Import…→Existing Projects into Workspace and select the root project directory.

environmentsetup.txt · Last modified: 2019/07/17 13:51 by