Changing the code

I have downloaded the source code from github repository and I compiled with success (snap-engine, snap-desktop and s1tbx). Now I can use and try the latest versions (snapshots) which is already very good.

Now I would like to change the code according to my needs. Who knows I can contribute to the community.

Although I have great experience with other programming languages such as python, C, C# and matlab I never worked with java so please bear with me if I come with basic doubts.

My first problem is related with the manipulation of the operatores’ code in SNAP\s1tbx\s1tbx-op-sentinel1\src\main\java\org\esa\s1tbx\sentinel1\gpf

For example I tried to apply few changes to the code of SpectralDiversityOp.java and I have noted that after the compilation of the s1tbx my changes does not take place when I run SNAP\snap-desktop\snap-appliction\target\snap\bin\snap64.exe. Everything works like before.

Can someone help me?

Thanks in advance.

You modified the code and recompiled in IntelliJ or some other environment? If that’s the case, in the run configuration, make sure you are specifying the patches in program arguements
–clusters
“E:\build\SNAP\s1tbx\s1tbx-kit\target\netbeans_clusters\s1tbx”;“E:\build\SNAP\s2tbx\s2tbx-kit\target\netbeans_clusters\s2tbx”;“E:\build\SNAP\s3tbx\s3tbx-kit\target\netbeans_clusters\s3tbx”;“E:\build\SNAP\s1tbx\s1tbx-kit\target\netbeans_clusters\rstb”
–patches
“E:\build\SNAP\snap-engine$\target\classes”;“E:\build\SNAP\s1tbx$\target\classes”;“E:\build\SNAP\s2tbx$\target\classes”;“E:\build\SNAP\s3tbx$\target\classes”;“E:\build\SNAP\s1tbx\rstb$\target\classes”;“E:\build\SNAP\s1tbx\jlinda$\target\classes”

If you are just running from that target folder, try recompiling from maven

First I tried to use IntelliJ with those configurations but only for s1tbx. But when I ran the Launcher.java snap became very very slow. So I changed my strategy.

Now I change the code in a normal text editor (emacs) and then I run the following command on the s1tbx’s folder:
mvn clean install

To test the changed operator I run SNAP\snap-desktop\snap-appliction\target\snap\bin\snap64.exe and there I choose the operator, fill the form and click run.

Should this procedure be enough? Or am I skipping something?

Do you know the Developer Guide already?

After changing the code it might be necessary to call
mvn clean install
and if you think the changes haven’t been taken over call additionally
mvn nbm:cluster
This rebuilds the so called cluster for the toolbox