How to setup GPT commandline from source code?

I have built SNAP from source taking tag 3.0.0 from github. (snap-engine, snap-desktop, s3tbx) on my Ubuntu32 system.
Is there any maven step or other script to be used to create the gpt command line tool usually available in the bin folder of an installation package? (I suppose a

I see that on snap-gpf there is the GPT java class. Is there any way to “create” the executable to be used from shell?
(I suppose it will be some java call with proper -classpath and path settings to properly load modules, SPIs and what else)


This is not possible in this way. The executable is generated by our installer.
But you can start it from your IDE.
Follow the setting here in the screen shot:

Actually this should be something mentioned in our developer guide. I hope I can add it ion Friday.

Thanks Marco.
This is what I use indeed for debugging on eclipse.

However, my final objective is to run some shell scripts which invoke GPT to perform some batch processing.
Suppose I’m building SNAP from github on a Centos machine or on Ubuntu 32 for which there is no installer.
How could I access the GPT capabilities from shell?
Is there any tip or set of instructions to have all the required jars/configs stored somewhere so that I can invoke that GPT java class with all readers/functionalities available?
Or is there any chance to access the installer to create the script on the hosting system (Centos, Ubuntu32,…)?

Thanks again for your assistance.

Can you inspect the gpt executable script from a previous linux binary release, and try analogous commands to launch the version you compiled?

Hi Benjimin,
I have already tried “lurking” from the Ubuntu 64 installation as well as from the SNAP 2.0.2 linux 64 installation but as soon as it find that I have a 32bit OS, it stop the installation due to wrong architecture so I can’t go to the end and check the script content.

I’ll try again in the next days, probably looking for a Linux 64 bit machine around in the office.

I think I have basically done.
Sharing my feedbacks in case anyone has similar issues in the future or to get additional suggestions or improvements.

I have accessed a remote Ubuntu64 machine and installed SNAP for Ubuntu64 there.
On my Ubuntu32 machine, I have created a SNAP folder.
I have copied the gpt executable from remote to my machine on SNAP/bin.

  • I went to snap-engine code folder (the github clone) in my machine and run:
    mvn dependency:copy-dependencies -DoutputDirectory=/work/snap-engine-dependencies
  • I have copied all the jars generated in that outputDir to a SNAP/snap/modules/ folder
  • I did the same for the s3tbx (using a different outputDirectory) and copied the only jars I need (basically the Sentinel3 reader jar only) to SNAP/s3tbx/modules

I have downloaded install4j and extracted on my local machine. Then, I have moved its internal .install4j folder beside SNAP/bin. Looked for a XXXXXX.lprop file within .install4j having content (164=1 162=0 148=0 106=1). Not sure what these numbers mean. I suppose they are some configuration flags but I didn’t investigate on that anymore.

Finally I have updated my gpt executable by changing

  • com.install4j.runtime.launcher.UnixLauncher launch XXXXXXX with that value.
  • add_class_path entry previously referring snap/modules/ext/org.esa.snap.snap-core/org-esa-snap/snap-runtime.jar to the jar previously built with maven which in my case was /snap/modules/snap-runtime-3.0.0.jar

After that, I was able to run gpt :slight_smile:

I’m pretty sure that I could improve a bit this situation on my machine but I was in hurry to do some performances test so, for the moment, I’m fine with that.


Great job Daniele.
Sorry for not answering earlier. What you have done can be simplified and you don’t need to use install4j.

In the snap-engine-kit module is an assembly defined. This assembles all the necessary jars into one zip file.
Move into the directory snap-engine/snap-engine-kit and execute on the command line
mvn clean package assembly:assembly.
This will create the snap-engine-<version>.zip file.
This zip contains three directories lib, modules and licenses.
The s3tbx modules need to be added manually to the modules dir.

Also I have just updated this assembly to include scripts (in a 4th directory ‘bin’) to start gpt from the shell.

1 Like

Thanks a lot Marco for your feedbacks and updates on the bin.
I’ll try your steps in a couple of days.
That would make the deployment on other machines very easy.


Thanks Marco,
it worked :thumbsup:
Do you have any chance to backport that assembly update to 3.x too?

Should be possible. I try to do it next week.


More character to reach the stupid 20 characters limit