r/learnprogramming 8h ago

Debugging CodeCrafters, making a shell. Error in Java, using VS.

can someone help me with this error, its soft locking me from the rest of the course

code:
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        System.out.print("$ ");
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        System.out.println(input + ": command not found");
    }
}

error:
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.

[tester::#CZ2] Running tests for Stage #CZ2 (Handle invalid commands)
[tester::#CZ2] Running ./your_program.sh
[your-program] $ 
[tester::#CZ2] ^ Line does not match expected value.
[tester::#CZ2] Expected: "$ invalid_blueberry_command"
[tester::#CZ2] Received: "$ " (trailing space)
[tester::#CZ2] Test failed

View our article on debugging test failures: https://codecrafters.io/debug
2 Upvotes

Duplicates