Keystrokes work only sporadically in the scala REPL (a key works sometimes, other times not). Windows 11. Scala 3.4.2. Java Version 8 update 411. I am new to scala.
Welcome to the Scala community.
Is your keyboard working OK? Can you try a different keyboard?
Is your command line working OK? Can you try a different Terminal? Powershell maybe? (I don’t know much about Windows)
You should update your Java version to at least 11.
Are you launching via Scala-cli? Or Scala directly?
I would recommend trying scala-cli… Scala-cli will shortly become the Scala command …
scala-cli works! Problem solved.
Many sincere thanks for your quick and helpful reply
It might be because Scala-cli uses a newer JVM. I think it requires 17, and downloads it if it’s not present.
If you start running into other issues outside the REPL, then try newer JVM versions.
Thanks!
For the record, Scala 3.4.2 has JLine 3.25.1 since this commit and Scala 2.13.14 since this commit.
“I don’t have a Windows 11 box to test on,” but I see there is a current ticket that is Windows-specific and says “missing keystrokes” in the title. There is no diagnosis or precise reproduction, but maybe some combination of factors causes a problem.
Since the solution here was to use scala-cli
, I guess this problem used scala
at a command line prompt and not from the sbt
prompt. In any case, the other item to verify is that the correct jline.jar
and related jna.jar
are getting used.
There was a previous issue with JDK 8 support in JLine that is not relevant here, but just goes to show that you can’t take anything for granted. Probably “don’t use JDK 8 any more” is good advice for those just starting out. I don’t know if there is any reason not to “use JDK 21 by default”.
I had the same issue using Windows 11. The problem was related to the JDK version because I installed the latest one available now (version 22), now I downgraded it to the version 21 and it worked fine.
Ahh this is probably my issue. I’m using 22 as well, but I’m going to try Scala-cli first. Also, I’m going through the introduction to Scala pages and it says you can use “Scala3” but I’m getting the “not recognized as cmdlet”. This is all in Powershell on Windows 10.
E: Scala-cli works nicely.