Build CHRIS-Box from source

The following gives a brief introduction how to build the CHRIS-Box. More information on how to build and develop for SNAP can be found in the SNAP Developer Guide. To build CHRIS-BOX you need to download and install the following tools.

  • Install Java 8 JDK and set JAVA_HOME accordingly. A distribution of OpenJDK is suggested. Several distributions are available, for example

  • Install Maven and set MAVEN_HOME accordingly.

  • Install git

Add $JAVA_HOME/bin, $MAVEN_HOME/bin to your PATH.

Clone the CHRIS-Box source code into a directory referred to as ${chrisbox} from here on. The source code is publicly available at GitHub.

cd ${chrisbox} git clone https://github.com/senbox-org/chris-box.git

Build Chris-Box:

cd ${chrisbox} mvn install

Setting up IntelliJ IDEA

To let the compiled code run, it is best to use an installed version of SNAP. SNAP can be downloaded from the STEP website. The following section describes how the IntelliJ Idea can be configured. Other IDEs can be configured accordingly.

  • Create a new Project from Existing Sources… and select the pom.xml in the ${chrisbox} directory

  • Set the JDK and the language level in the Project Settings

  • Now create a run configuration.

    • Main Class: org.esa.snap.nbexec.Launcher

    • VM options: -Dsun.awt.nopixfmt=true -Dsun.java2d.noddraw=true -Dsun.java2d.dpiaware=false -Dorg.netbeans.level=INFO -Xmx6G

    • Program arguments: --userdir "${chris-box}\userdir\.snap"
      --clusters "${chris-box}\chris-kit\target\netbeans_clusters\chris"
      --patches ${chris-box}\$\target\classes"

    • Working directory: ${SNAP_INSTALLATION_DIR}

    • Use classpath of module: chris-kit

Where ${SNAP_INSTALLATION_DIR} point to the directory where SNAP is installed.

Run SNAP with CHRIS-Box build output

Alternatively, SNAP be configured to pick up the build output. Then after a new build has been generated only SNAP needs to be started. The folder of the CHRIS-Box build output needs to be configured as a so-called cluster (group of modules).

In the etc folder of the SNAP installation directory is a file located named snap.conf. This file needs to be opened (admin rights required) in a text editor and the path needs to be added.

# Extra cluster paths separated by semicolon ';'
extra_clusters="${chrisbox}\chris-kit\target\netbeans_clusters\chris"

Be default the extra_clusters line starts with a '#'. Remove this character too.
Now, SNAP starts with the CHRIS-Box modules loaded.