clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
borkdude 2020-10-23T14:18:06.083800Z

Has anyone ever seen problems like this with compile on Windows?

user=> (require 'puget-cli.main)
nil
user=> (compile 'puget-cli.main)
Unexpected error (IOException) macroexpanding clojure.core/gen-class at (puget_cli\main.clj:1:1).
The system cannot find the path specified

borkdude 2020-10-23T14:18:57.084200Z

oh crap, this is because the classes dir doesn't exist probably

alexmiller 2020-10-23T14:19:02.084400Z

yeah

borkdude 2020-10-23T14:45:25.084700Z

ok, it worked now: https://github.com/borkdude/puget-cli

littleli 2020-10-23T15:28:36.085Z

Amazing. Once you have regular releases, at least prereleases, let me know. I'm going to package it. Looks great ❤️

borkdude 2020-10-23T15:31:45.085200Z

Sure. I'll await some feedback and once I'm fairly certain it's good to go, I'll let you know

evocatus 2020-10-23T22:44:19.085500Z

Hi!

evocatus 2020-10-23T22:45:45.086800Z

I installed cli tools on Windows 10 folloing the official docs and I have a rather weird result: clj -h runs ok but clj raises an error:

Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main

seancorfield 2020-10-23T22:53:10.087100Z

@gr.evocatus What does clojure -Sdescribe show you?

evocatus 2020-10-25T13:12:33.087200Z

{:version "1.10.1.697"
 :config-files ["C:\Users\Рома\Documents\WindowsPowerShell\Modules\ClojureTools\deps.edn" "C:\Users\Рома\.clojure\deps.edn" "deps.edn"]
 :config-user "C:\Users\Рома\.clojure\deps.edn"
 :config-project "deps.edn"
 :install-dir "C:\Users\Рома\Documents\WindowsPowerShell\Modules\ClojureTools"
 :config-dir "C:\Users\Рома\.clojure"
 :cache-dir "C:\Users\Рома\.clojure\.cpcache"
 :force False
 :repro False
 :main-aliases ""
 :repl-aliases ""
 :exec-aliases ""}

seancorfield 2020-10-25T19:44:57.087400Z

Is there a deps.edn in the folder in which you are running clj? If so, what is in it?

seancorfield 2020-10-25T19:46:12.087600Z

Also, could you confirm that when you run clj -h, this is what you see:

$ clj -h
Version: 1.10.1.697

You use the Clojure tools ('clj' or 'clojure') to run Clojure programs
on the JVM, e.g. to start a REPL or invoke a specific function with data.
The Clojure tools will configure the JVM process by defining a classpath
(of desired libraries), an execution environment (JVM options) and
specifying a main class and args.

seancorfield 2020-10-25T19:46:50.087800Z

(and a bunch more stuff, including all the options)

seancorfield 2020-10-25T19:49:56.088Z

Could you try clojure -Sforce -r and let me know whether that produces a basic REPL or gives an error?

seancorfield 2020-10-25T19:51:15.088200Z

If the help from clj -h doesn't look like the above and the clojure -Sforce -r command produces a REPL, then I think you may have a rogue clj script that is hiding the official script. There used to be an old, unofficial clj script that some people installed.

evocatus 2020-10-25T21:50:55.088400Z

No, there is no deps.edn in the folder I run clj in. And clj -h output starts exactly like you wrote.

evocatus 2020-10-25T21:52:31.088600Z

clojure -Sforce -r gives an error

WARNING: When invoking clojure.main, use -M
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main

seancorfield 2020-10-25T22:11:37.088900Z

Sorry, I've no idea. Perhaps uninstall it and use scoop to install it instead? (per the instructions at the bottom of that clj-on-window wiki page)

seancorfield 2020-10-25T22:12:31.089100Z

I'll be honest, when I got my new Win10 laptop, I gave up on Powershell and instead installed WSL2 and Ubuntu and I have all my Clojure dev env on Linux (using brew aka linuxbrew)

seancorfield 2020-10-25T22:13:48.089300Z

Quoting arguments is really messy on Powershell -- and all the tutorials and instructions out there really assume macOS or Linux, so it really is a lot easier to just use WSL2 for Clojure work on Windows.

seancorfield 2020-10-25T22:15:13.089500Z

And if you install VcXsrv (Xlaunch) then you can run Linux apps with GUIs and they run just fine: I have Atom installed on WSL2 and use it running via Xlaunch for all my editing, with Reveal for visualizing data, also launched from WSL2 and running via Xlaunch.

evocatus 2020-10-25T22:18:52.089700Z

Thanks for your help anyway

seancorfield 2020-10-25T22:21:03.089900Z

The latest version on https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows is 1.10.1.727 so you could try installing that I guess. Looks like the instructions have changed since I last tried PS