Any suggestions on how I can diagnose this error
➜ ~ clojure
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
It happens on Termux (Android phone), but not the Termux (Android Tablet) 🤯
They both used to work very well.
I wonder if I have messed up a shell setting or other environment variable, as the versions of java and clojure cli tool are the same. I haven't found a difference yet though.
clojure --version does work at least 🤣
Any suggestions welcome, I appreciate this is quite nichemaybe running like clojure -J-verbose:class ?
or clojure -Spath first, to see that the clojure jar is on the classpath?
i remember this happening when people installed clojure from the package managers. Someone made a little script a long time ago to boot up a repl but this is not the clojure command line tool that you are expecting
what does clojure --version output
The working Termux on the tablet had
Clojure CLI version 1.11.1.1435
The failing Termux on the phone had version 1.12.0.1479
I downgraded and upgraded Clojure CLI versions on both Termux environments to ensure it wasn't a particular version (it seems not, as Termux on Tablet still works okay with latest stable release.
Running clojure with either the verbose and path argument fails sith the same error.what’s in your m2 cache for clojure? perhaps that is corrupted?
you can try running java with the 3 jars by hand like java -cp /home/jmonetta/.m2/repository/org/clojure/clojure/1.12.0/clojure-1.12.0.jar:/home/jmonetta/.m2/repository/org/clojure/core.specs.alpha/0.4.74/core.specs.alpha-0.4.74.jar:/home/jmonetta/.m2/repository/org/clojure/spec.alpha/0.5.238/spec.alpha-0.5.238.jar clojure.main
There is no .m2 directory.... I deleted it thinking the same, that something was corrupted. Its curious that a new .m2 directory was not created. Perhaps somethin in the environment is silently failing when trying to download clojure libs
these are the md5sums of my jars :
md5sum /home/jmonetta/.m2/repository/org/clojure/clojure/1.12.0/clojure-1.12.0.jar
674322e2210fcd1a807b3526f74c9242 /home/jmonetta/.m2/repository/org/clojure/clojure/1.12.0/clojure-1.12.0.jar
md5sum /home/jmonetta/.m2/repository/org/clojure/core.specs.alpha/0.4.74/core.specs.alpha-0.4.74.jar
ebd37b9a3c39e6b769fc1463737cb8d4 /home/jmonetta/.m2/repository/org/clojure/core.specs.alpha/0.4.74/core.specs.alpha-0.4.74.jar
md5sum /home/jmonetta/.m2/repository/org/clojure/spec.alpha/0.5.238/spec.alpha-0.5.238.jar
9f5ea5239dc04d6a8115add1e4f5f23a /home/jmonetta/.m2/repository/org/clojure/spec.alpha/0.5.238/spec.alpha-0.5.238.jarI will check the script for the commands to download the Clojure jars from Maven. If I cannot fix downloading libs via the clojure command, then it seems better to take the scorched earth approach (backup & reinstall termux on the phone) If I do get the libs downloading and it still fails then I"ll try running clojure with the java command (it will remind me of 2009, when first dabbling with Clojure)
I'll reinstall termux and start from scratch. as even calling clojure with java command fails (so nothing to do with Clojure CLI it seems)
➜ ~ java -cp ../usr/lib/clojure/libexec/clojure-tools-1.12.0.1488.jar clojure.main Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Thanks for all the suggestions to try.i wouldn’t expect that to work. clojure-tools won’t provide clojure the language (and clojure.main)
Well it ran a clojure repl on the termux where the clojure command was already working (and failing where clojure wasnt) I didn't extensively test it, but it seems a reasonable assumption that the install jar can call clojure.main and run the repl.
That JAR in the CLI install is a full uberjar that includes the Clojure runtime so, yes, it totally should work. It sounds like your CLI install on that machine is corrupted.
> java -cp clojure-tools-1.12.0.1530.jar clojure.main
Clojure 1.12.0
user=>