Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SBT console "swallow" keypresses on JDK 22 and Windows 10 #7580

Open
nartamonov opened this issue Jun 13, 2024 · 0 comments
Open

SBT console "swallow" keypresses on JDK 22 and Windows 10 #7580

nartamonov opened this issue Jun 13, 2024 · 0 comments
Labels
area/jdk_x jdk 9, 10, 11, 17 etc Bug

Comments

@nartamonov
Copy link

steps

Install Eclipse Temurin 22.0.1+8 in Windows 10. Run the SBT console for any project from the cmd.exe terminal. Then try to work in the console: enter different commands, try to insert into the console text from the clipboard.

problem

The SBT console "swallows" (skips) certain key strokes: symbols do not appear in the console. Also does not work properly copy and paste.

cause and workaround

The problem seems to be that JDK 22 has changed the behavior of System.console():

In JDK 22, System.console() has been changed to return a Console with enhanced editing features that improve the experience of programs that use the Console API. In addition, System.console() now returns a Console object when the standard streams are redirected or connected to a virtual terminal. Prior to JDK 22, System.console() instead returned null for these cases. This change may impact code that checks the return from System.console() to test if the JVM is connected to a terminal. If required, the -Djdk.console=java.base flag will restore the old behavior where the console is only returned when it is connected to a terminal. Starting JDK 22, one could also use the new Console.isTerminal() method to test if the console is connected to a terminal.

Setting the -Djdk.console=java.base option in .jvmopts solves the problem: SBT starts working normally.

@nartamonov nartamonov added the Bug label Jun 13, 2024
@eed3si9n eed3si9n added the area/jdk_x jdk 9, 10, 11, 17 etc label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jdk_x jdk 9, 10, 11, 17 etc Bug
Projects
None yet
Development

No branches or pull requests

2 participants