Evaluation failed because the thread is not suspended

Viewed 9739

users! I have a problem with my Microsoft VS Code. When i run my code with method

System.in.read() 

i have a problem "Evaluation failed because the thread is not suspended."

P.S. When i run file using javac and java this code is work.

i also have problem with VS Code another problem

My code

import java.io.IOException;

public class example {
    public static void main(String args[])
    throws IOException {
        char symbol;
        int count = 0, count_space = 0;
        do {
            symbol = (char) System.in.read();
            if (symbol == ' ') {
                count_space += 1;
            }
            count += 1;
        } while(symbol != '.');
        System.out.println("Всего символов: " + count);
        System.out.println("Из них пробелов: " + count_space);
     }
}

Sorry for bad grammar. Can you help me?

1 Answers

I'm a chinese student and i had the same problem. I found a solution in baidu.

The built-in debugging console of vscode does not support java input. So you need to modify the debug console in the debug configuration file (launch.json), just modify the console property from "internalConsole" to "integratedTerminal" or "externalTerminal".

Related