Once you have checked out the project as described in How to build SNAP from sources you can configure IntelliJ IDEA.

Importing source code as a Project

Launching and Debugging

In order to launch and debug SNAP you need to create a run configuration. Before doing so you first need to build the project via maven. You can either do this from the command line or from the Maven window in Intellij IDEA. You simply need to invoke mvn package for each of the projects you have checked out. This is necessary to have the target directories available which will be referenced in the run configuration.

Run plain SNAP Desktop

Select Run/Edit Configurations and add a new configuration named Application.
In the following <snap-app> is an abbreviation for <myprojects>/snap/snap-desktop/snap-application/target/snap:

Note that in the configuration above, the SNAP user directory at <snap-app>/../userdir will be deleted after each clean build. This is by intention. If you want to keep your settings during development (not recommended), you can configure the SNAP user directory to any other location outside of the target directory.

The '$' character in the patches path is a place holder for all the sub-modules in this project.

you can add the --open option to the program arguments to specify one more paths to products which shall be opened on start up. Also a session file is possible.

Run SNAP Desktop with additional Toolboxes (microwave, optical, smos, ...)

If you want to use one or more toolboxes with SNAP Desktop you need to do the following. You can use the previous configuration as template by copying it.

Note that you can add multiple run configurations. One for plain SNAP Desktop, one with s1tbx, one with smos, one with s2tbx and s3tbx, and other combinations. This gives you the flixbility to run SNAP in different configurations.


For Unix-users: In the following the ';' character is use to separate the paths. That's the seperator for Windows. On Unix based system you should use ':' instead,

Extend the --patches option to include the compile output of the toolboxes.

--patches "<myprojects>/snap/snap-engine/$/target/classes;<myprojects>/snap/microwave-toolbox/$/target/classes;<myprojects>/snap/microwave-toolbox/rstb/$/target/classes;<myprojects>/snap/microwave-toolbox/jlinda/$/target/classes;<myprojects>/snap/optical-toolbox/$/target/classes"

Additionally the --clusters option needs to be set. The clusters contain all modules of a toolbox and are located in the so called kit module of each of them.

--clusters "<myprojects>/snap/microwave-toolbox/microwavetbx-kit/target/netbeans_clusters/microwavetbx;<myprojects>/snap/microwave-toolbox/microwavetbx-kit/target/netbeans_clusters/rstb;<myprojects>/snap/optical-toolbox/opttbx-kit/target/netbeans_clusters/opttbx"

Run gpt

In order to run gpt directly from the IntelliJ IDEA you should use the following configuration.

As Program arguments you can specify the arguments you usually use with gpt. If you have enough memory available you can increase the value for the Xmx option. This value defines how much memory SNAP can use. Make sure that you leave some spare memory for the OS and other applications.