Aha! I used cs launch because I wanted to make sure not to pick the other scala I have installed using sdkman.
If I do sdk install scala
it WORKS
So I’m trying to figure out how to use the cs binary scala whithout uninstalling sdk…
Aha! I used cs launch because I wanted to make sure not to pick the other scala I have installed using sdkman.
If I do sdk install scala
it WORKS
So I’m trying to figure out how to use the cs binary scala whithout uninstalling sdk…
I guess it would be good if cs launch scala
would work, even if it is esoteric…
I guess it would be good if
cs launch scala
would work, even if it is esoteric…
That is the thing. It technically does work. It takes the JAR for the Scala runner, as it’s supposed to.
It’s just not the JAR one’d have in mind, because what one’d have in mind is not a JAR!
Ahhh, this is a headache.
I agree we should find a way to improve the UX of this, but this is technically not a bug, really.
I see. OK so after
$ rm -rf ~/.sdkman
$ nano ~/.bashrc # remove sdkman stuff
then
$ scala
Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>
(I guess I was too brutal to nuke all sdkman and could have dunnit with just sdk uninstall scala…)
EDIT: problems unfortunately re-appeared, se further down…
blog post published: Scala 3.5.0 released! | The Scala Programming Language
This is what I get on windows after updating coursier and installing scala 3.5.0 via coursier:
$ scala -version
Scala code runner version: 1.4.0
Scala version (default): 3.5.0
Your Scala code runner version is outdated. The newest version is 1.4.3
It is recommended that you update Scala code runner through the same tool or method you used for its initial installation for avoiding the creation of outdated duplicates.
The outdated warning should not exist for a default 3.5.0 runner, no?
I was celebrating to fast… When trying a clean install on another ubuntu box I got the warning again and also more students reporting about the warning
I will nuke cs on the box where it actually worked and see if it still works. BRB
OK so I nuked cs on a machine with ubuntu 22.04 where I got the new scala runner to work and then just reinstalled and it stopped working
Scroll further down to see the resurrection of the failure…
$ scala
Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>
$ cs version
2.1.10
$ cs uninstall --all
Uninstalled amm
Uninstalled coursier
Uninstalled cs
Uninstalled sbt
Uninstalled sbtn
Uninstalled scala
Uninstalled scala-cli
Uninstalled scalac
Uninstalled scalafmt
$ curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 19.9M 100 19.9M 0 0 4362k 0 0:00:04 0:00:04 --:--:-- 5763k
Checking if a JVM is installed
Found a JVM installed under /usr/lib/jvm/java-21-openjdk-amd64.
Checking if ~/.local/share/coursier/bin is in PATH
Checking if the standard Scala applications are installed
Installed ammonite
Installed cs
Installed coursier
Installed scala
Installed scalac
Installed scala-cli
Installed sbt
Installed sbtn
Installed scalafmt
$ scala
[warning] MainGenericRunner class is deprecated since Scala 3.5.0, and Scala CLI features will not work.
[warning] Please be sure to update to the Scala CLI launcher to use the new features.
[warning] It appears that your Coursier-based Scala installation is misconfigured.
[warning] To update to the new Scala CLI runner, please update (coursier, cs) commands first before re-installing scala.
[warning] Check the Scala 3.5.0 release notes to troubleshoot your installation.
Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala>
$ cs version
2.1.10
something is really fishy here…
I have now tried both https://github.com/coursier/coursier/releases/download/v2.1.10/cs-x86_64-pc-linux.gz
and the one on coursier installation page here https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz
and (just to make sure they were the same) and none works
I guess the courrier launcher hasn’t changed during the day so something else has to have changed as it first didn’t work, then did work and then stopped working…
Now I have no clue of what to try further. @Gedochao @WojciechMazur
EDIT:
@soronpo Can you get it to work if you also cs install scala:3.5.0
and then just scala
?
EDIT2: I actually got it to work if I did a new clean install and the ALSO did an explicit
cs install scala:3.5.0
and then just scala
But the need to do this extra step will make people stumble as it is not part of the install instruction (and shouldn’t have to be)…
For reference, I think this is the issue: Scala 3.5 is using the wrong main class · Issue #238 · coursier/apps · GitHub
Thanks!
This also works for Windows, I lost quite some time trying to make it work…
They should include this in the blogpost for 3.5.0.
From the release instruction you’re supposed to do: cs install scala:3.5.0 && cs install scalac:3.5.0
I will say that I ran this in admin console on Windows since I first installed cs in admin (probably a mistake) long ago.
Thanks @bjornregnell for taking the hit for us
So, it’s better to stick to SDKMAN for now… (it was so ridiculously easy and works)
For educators: one more important reason to stick with SDKMAN is that, you might need a JVM with the JavaFX libraries included if you are teaching GUI. With Coursier it’s impossible to know which JVMs have FX in them in cs java --available
. Liberica “full” seems to have it…
Also, can confirm scala install-completions
works (at least on Zsh)!
Thanks @bjornregnell for taking the hit for us
Thanks It became a late night… But workaround found.
So, it’s better to stick to SDKMAN for now… (it was so ridiculously easy and works)
It’s nice but majority of students on Windows. So cs installer vital.
I think we should asap both update the blog post and install page to tell about cs install scala:3.5.0
until this is fixed so that people don’t spend grit on this. @WojciechMazur @SethTisue Would be really helpful if this can be done?
When it will Just Works™ it will be so cool!
Oh right, I keep forgetting SDK does not exist on Windows (We require installing Linux on day 1, for many other reasons)
PR merged: Possible recommendation to fix Scala installation by bishabosha · Pull Request #239 · coursier/apps · GitHub
Many thanks to @bishabosha and others
Have you tried with Chocolatey?
+1, Chocolatey should now be the most convenient installation method for Windows users.
Either way, Coursier should work fine now, too (thanks to @bishabosha’s fix)
Yes I’ve been thinking about choco but there is also winget and what not… Best not to have special arrangements for each platform so cs is awesome for both teachers and terminal beginners if it Just Works™.
I saw BTW that scala 3.5.0 is out on choco already! That’s great!! What is the story with winget? (choco is after all a payed thingy and winget seems more “offical” as it is ruled by the plaform owner itself…)
What is the story with winget?
Already implemented, but I believe we’re only getting this released in 3.6.0 (credit to @hamzaremmal)