Keyboard doesn't work in REPL

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.

1 Like

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 :slight_smile:

1 Like

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!

1 Like

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

2 Likes

:+1: :+1: :+1: