When using the Scanner class, the debugger does nothing when typing in a value. It stops with the message below.
public static void main( String[] args )
{
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
scanner.close();
}
Failed to evaluate. Reason: Cannot evaluate because the thread is resumed.
There is nothing more. No breakpoint set, just created a default java launch and it stopped there
Based on "The default Debug Console in VS Code doesn't support inputs. In case your program need inputs from terminal, you can use Integrated Terminal within VS Code or external terminal to launch it.."
https://code.visualstudio.com/docs/java/java-debugging
My workaround is to edit the launch.json and change console to use integratedTerminal
Oh, I must have completely skipped over that part.
The workaround is acceptable, but it would be nicer, if VS Code would support inputs from terminal.
Thanks a lot.
I'm not sure why this is closed? There's a workaround, yes, but does that mean it's not an issue?
Is there any reason why the debug console shouldn't accept inputs?
@Victorious3 For this issue:
Most helpful comment
@Victorious3 For this issue: