Gx: ClassNotFoundException

Hello,

I’ve downloaded gx and moved the libs into /usr/local/lib/gx and then updated the CLASSPATH variable:

export CLASSPATH="/usr/local/lib/gx:/usr/local/lib/gx/commons-logging-1.1.3.jar:/usr/local/lib/gx/gitx-cli-1.0.0-beta1.jar:/usr/local/lib/gx/httpclient-4.3.6.jar:/usr/local/lib/gx/httpcore-4.3.3.jar:/usr/local/lib/gx/picocli-4.4.0.jar:/usr/local/lib/gx/logback-classic-1.2.3.jar:/usr/local/lib/gx/logback-core-1.2.3.jar:/usr/local/lib/gx/annotations-16.0.1.jar:/usr/local/lib/gx/org.eclipse.jgit-4.6.1.201703071140-r.jar:/usr/local/lib/gx/communism-git-1.0.0-SNAPSHOT.jar:/usr/local/lib/gx/commons-codec-1.6.jar:/usr/local/lib/gx/jsch-0.1.53.jar:/usr/local/lib/gx/javax.inject-1.jar:/usr/local/lib/gx/gitx-core-1.0.0-SNAPSHOT.jar:/usr/local/lib/gx/communism-util-1.0.0-20201211.192215-105.jar:/usr/local/lib/gx/JavaEWAH-1.1.6.jar:/usr/local/lib/gx/slf4j-api-1.7.25.jar"

When I execute gx, I get the following error:

Error: Could not find or load main class org.tmatesoft.gitx.cli.GitXCommand
Caused by: java.lang.ClassNotFoundException: org.tmatesoft.gitx.cli.GitXCommand

What am I missing?

Thanks,
Pawel

Hello Pawel,
I tried the same steps and everything works for me, so I can confirm that the steps are correct.

It’s difficult to say what’s wrong in your case. I would check permissions problems first. If you’re using Windows (e.g. with Cygwin), Java has different path separator there (’;’ instead of ‘:’). Not sure if Java version could be an issue, we require it to be at least 1.8.

The missing class is contained in /usr/local/lib/gx/gitx-cli-1.0.0-beta1.jar, you can check that by unzipping it.

If nothing above is your issue, I have no other idea. Basically the script runs ‘java’ passing a list of jars as a classpath; and GitXCommand is just inside one of those jars.

Hello Dmitry,
Are you using OpenJDK? I have version 11.0.11 2021-04-20.
Thanks,
Pawel

Hello Dmitry,

Ok…got it…just commented out the CLASSPATH in the gx script and now it’s running! Hoorah!

Thanks,
Pawel