clj-on-windows 2020-06-02

@timon01 (continuing from a thread in #beginners ) -- What version of Windows are you running, and what version of Powershell do you have installed?

@timon01 has joined the channel

Windows 10 powershell: 5.1.17134.858. After previous error I decided to go into path System32/WindowsPowerShell/v1.0 and type there scoop install clojure . Install completes fine, but with pic, which errors writed on russian, it is translates like: "Can't find the way for powershell.exe, because it not existing" The second one is about "attrib": Name "attrib" unidentified like name of command, function or script e.t.c. Install is complete, but then I type "clj", I get the same message: Error: Could not find or load main class clojure.main.

As a temporary workaround you could try deps.clj: https://github.com/borkdude/deps.clj

@borkdude thx. but this is all like kind of my subproblem. My main purpose is that I need to compile my clojure files in android studio, to make my application run with clojure and kotlin/java. I tried clojurephant but it is not compile at all. I thinked it because i miss the quickstart three steps with clojure CLI. I also installed Cursive plugin for android studio, and when i try to debug single function i get the same magic error message. maybe some relation exist between my problems? Error: Could not find or load main class clojure.main Process finished with exit code 1

@timon01 Could it be that you have a very old version of clojure installed somewhere? That wouldn't be the first time I've seen it

Can you post the output of clojure -Sdescribe?

or the first lines of clojure -h

maybe it all because cyrilyc symbols in path?

The output of this looks ok

What do you get for clojure -Spath?

Also looks ok. What about clojure -e "(+ 1 2 3)" ?

Have you tried closing the powershell window, starting a new one and then issue this command again?

Other ideas: install lein, and try lein repl, see if that does work. Also try deps.clj, to check if it's something in the powershell scripting of clj on windows.

same problem. ok i'll try these things

Alex Miller (Clojure team) 2020-06-02T19:21:01.066600Z

I wonder if it's anything with non-latin characters in the user path. clojure just builds on java for all that but depending on your default character encoding I wonder if that's confusing something. just a long shot idea

Alex Miller (Clojure team) 2020-06-02T19:22:38.067Z

oh, I see that was suggested above

Alex Miller (Clojure team) 2020-06-02T19:23:54.068200Z

not finding clojure.main means you have a classpath issue. the classpath printed above "looks" like what I'd expect. you can get completely out of clj and just try java -cp <the-path-above> clojure.main

Alex Miller (Clojure team) 2020-06-02T19:24:15.068600Z

I guess I would verify that the clojure jar actually is where it says it is

👍 1

i get interesting error while java -cp C:\Users\Тимофей\.m2\repository\org\clojure\clojure\1.10.1\clojure-1.10.1.jar clojure.main . I am just replace encoding with cyrilic username.

@timon01 That error is expected, since you should also place spec on the classpath. Use the same classpath as output by clojure -Spath.

Wow, it works! thx! Did that problem happened from the encoding characters?

with them, it cannot execute properly

Alex Miller (Clojure team) 2020-06-02T20:07:04.071200Z

It looked like there were , in that path name before?

the difference seems to be quotes around the classpath here.

Alex Miller (Clojure team) 2020-06-02T20:07:54.072300Z

Well that implies something needing quoting

Alex Miller (Clojure team) 2020-06-02T20:08:31.073400Z

All of this is in the clj windows script, upstream of the java or Clojure parts

Not sure though, -Spath doesn't print quotes, hmm. But then something like clj -Scp "$(clojure -Spath)" should do the trick.

the PS equivalent of that

Alex Miller (Clojure team) 2020-06-02T20:10:37.076300Z

There is probably something to fix here, I just don’t know enough to fix it :)

@timon01 for completeness, can you try deps.exe downloadable from here? https://github.com/borkdude/deps.clj/releases/download/v0.0.8/deps.clj-0.0.8-windows-amd64.zip it doesn't use anything from powershell. then we can eliminate that it's in the PS script.

@alexmiller i replace encoded with username and it works

maybe the way to fix it is just install clojure for other user?

with latin characters*

it might be good to get this fixed and not just work around it

i tryed to open exe, but it just closing after i click on it

you shouldn't click on it. run it from the console

it's not a GUI, it's a command line tool

just like clj

something like that?

Ah, let me provide you a new version which doesn't invoke PowerShell anymore.

sorry for the hassle

kind of the same. Did i make something wrong?

Hi, I see I'm quite late to the installfest.

If powershell.exe cannot be found I would make sure PATH is correctly set. It may also happen sometimes that there is a syntax error and PATH is not explored properly because of the error. But that is a blind shot from my side.

@timon01 Make sure you throw away the old deps.exe and only use the new one. It shouldn't be invoking PowerShell in any way

@ales.najmann Welcome! It's been a fascinating discussion -- something to do with Cyrillic characters and encoding in classpath was at least partly to blame.

yeah 😞 these things can bite. In my language there are characters like these čěřů etc 🙂 but these are still Latin2

I'm not sure what's going on 😞

@timon01 In the stacktrace it shows the download function on line 202. That's from a previous version, not in the version that is from here: https://ci.appveyor.com/project/borkdude/deps-clj/builds/32785614/artifacts (which is built using this commit: https://github.com/borkdude/deps.clj/blob/8c512ce5f36aea08d9379509dad56d2fd2b44e9e/src/borkdude/deps.clj#L202)

let me just push version 0.0.9 to end all confusion

@borkdude yea, I noticed that, this is stacktrace from new one

Gotcha. Let me fix that.

@ales.najmann PATH looks like that, should I add path to powershell.exe?

(meanwhile I'm upgrading deps.clj to a newer GraalVM version...)

@timon01 when you type deps.exe -Sdescribe it should print :deps-clj-version "0.0.9" among other things.

and the final test is then: deps.exe followed by enter should start a Clojure REPL.

It works

🎉 1

So it's probably something in the .ps scripts of clj on windows then.

@timon01 So at least you can now use this as a workaround until the .ps script is fixed.

Might be good to post an issue about this.

@borkdude do you mean .ps script is what cyrilic encoding problem?

Yes. the clojure CLI consists of two parts: a shell script + a tools.jar which is invoked via java by the shell script. On Windows the shell script is implemented in Powershell. There's probably a bug or omission in that script which can be fixed by quoting the classpath.

deps.clj doesn't use shell scripts, it replaces bash and PowerShell with pure Clojure.

I put deps.clj in scoop too, but I wonder how shim behaves in this particular case... I'm afraid it calls Powershell anyway because of the "environment"

@ales.najmann Thanks. That probably works. My mistake in deps.clj was probably that "PowerShell" doesn't always work as the executable name on Windows. But now all usage of PowerShell is gone, so that's not a problem. Scoop probably has more intelligent stuff for this.