tools-deps

practicalli-johnny 2025-03-27T08:05:35.102349Z

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 niche

2025-03-27T12:20:58.301709Z

maybe running like clojure -J-verbose:class ?

2025-03-27T12:22:43.739219Z

or clojure -Spath first, to see that the clojure jar is on the classpath?

dpsutton 2025-03-27T15:55:12.513369Z

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

dpsutton 2025-03-27T15:56:07.025819Z

what does clojure --version output

practicalli-johnny 2025-03-27T18:21:51.754769Z

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.

dpsutton 2025-03-27T18:27:02.362399Z

what’s in your m2 cache for clojure? perhaps that is corrupted?

2025-03-27T18:29:22.590549Z

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

practicalli-johnny 2025-03-27T18:31:49.872149Z

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

2025-03-27T18:31:51.927989Z

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.jar

practicalli-johnny 2025-03-27T18:37:41.753139Z

I 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)

practicalli-johnny 2025-03-28T00:04:36.546899Z

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.

dpsutton 2025-03-28T00:08:38.390559Z

i wouldn’t expect that to work. clojure-tools won’t provide clojure the language (and clojure.main)

practicalli-johnny 2025-03-28T00:56:05.806479Z

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.

seancorfield 2025-03-28T04:29:28.963529Z

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=>

👍 1