ClassNotFoundException when calling gpt from the command line

Hello,

Since I updated snap, when I try to run a graph.xml from the command line, I end up with a ClassNotFoundException for the GPT class!

Is it just a bug that’s going to be fixed with future releases? Or did I make a mess when updating?

hakim@hakim ~/Data $ sudo /home/hakim/snap/bin/gpt /home/hakim/Data/York/preprocessing-pre.xml
Error: java.lang.ClassNotFoundException: org.esa.snap.framework.gpf.main.GPT
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.esa.snap.framework.gpf.main.GPT
at org.esa.snap.runtime.Launcher.lambda$run$12(Launcher.java:57)
at org.esa.snap.runtime.Engine.runClientCode(Engine.java:186)
at org.esa.snap.runtime.Launcher.run(Launcher.java:51)
at org.esa.snap.runtime.Launcher.main(Launcher.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:62)
at com.install4j.runtime.launcher.UnixLauncher.main(UnixLauncher.java:57)
Caused by: java.lang.ClassNotFoundException: org.esa.snap.framework.gpf.main.GPT
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.esa.snap.runtime.Launcher.lambda$run$12(Launcher.java:53)
… 9 more

Thanks.

Have you tried with the latest release? You seem to be using an older
version by the looks of org.esa.snap.framework

You’re right, it’s working now that I installed the last version of snap.
Thanks.

As the name suggests classNotFoundException in Java occurs when JVM (Java Virtual Machine) tries to load a particular class and doesn’t found the requested class in the classpath you specified. This means that, your classpath is broken (which is a very common problem in the Java world ). This problem can be particularly confusing for Java beginners. ClassNotFoundException is a checked exception , so it has to be catch or thrown to the caller.