Package Navigtion does not exist

In code examples, there is code that is not compilable.

Here is the code:

import Builtin.Executable;
  import Builtin.Type;
  import Navigation.Cd;
  import java.util.Arrays;
  import java.util.Scanner;
  
  public class Main {
    public static void main(String[] args) throws Exception { 
      Scanner scanner = new Scanner(System.in);
      Cd cd = new Cd();
      while (true) {
        System.out.print("$ ");
        String inputs = scanner.nextLine();
        String[] input = inputs.split(" ");
        String command = input[0];
        String argument =
        String.join(" ", Arrays.copyOfRange(input, 1, input.length));
  
      Cd cd = new Cd();
        switch (command) {
                  case "exit" -> System.exit(0);
                  case "echo" -> System.out.println(argument);
                  case "type" -> {
                      Type type = new Type();
                      type.isBuiltinOrPathOrNon(argument);
                  }
                  case "pwd" ->
                      // Cd has a method to get the current working dir
                          System.out.println(cd.getCwd());

                  case "cd" ->
                        cd.setCd(argument);
                  default -> {
                      if (!argument.isEmpty()) {
                          Executable executable = new Executable();
                          executable.execute(command, argument);
                      } else {
                          System.out.println(command + ": command not found");
                      }
                  }
              }
          }
      }
  }

Here is output:

[compile] [ERROR] COMPILATION ERROR : 
[compile] [INFO] -------------------------------------------------------------
[compile] [ERROR] /app/src/main/java/Main.java:[5,17] package Navigtion does not exist
[compile] [ERROR] /app/src/main/java/Main.java:[14,9] cannot find symbol
[compile]   symbol:   class Cd
[compile]   location: class Main
[compile] [ERROR] /app/src/main/java/Main.java:[14,21] cannot find symbol
[compile]   symbol:   class Cd
[compile]   location: class Main
[compile] [ERROR] /app/src/main/java/Main.java:[42,30] cannot find symbol
[compile]   symbol:   variable argument
[compile]   location: class Main
[compile] [INFO] 4 errors 
[compile] [INFO] -------------------------------------------------------------
[compile] [INFO] ------------------------------------------------------------------------
[compile] [INFO] BUILD FAILURE
[compile] [INFO] ------------------------------------------------------------------------
[compile] [INFO] Total time:  1.809 s
[compile] [INFO] Finished at: 2025-05-09T07:53:53Z
[compile] [INFO] ------------------------------------------------------------------------
[compile] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project codecrafters-shell: Compilation failure: Compilation failure: 
[compile] [ERROR] /app/src/main/java/Main.java:[5,17] package Navigtion does not exist
[compile] [ERROR] /app/src/main/java/Main.java:[14,9] cannot find symbol
[compile] [ERROR]   symbol:   class Cd
[compile] [ERROR]   location: class Main
[compile] [ERROR] /app/src/main/java/Main.java:[14,21] cannot find symbol
[compile] [ERROR]   symbol:   class Cd
[compile] [ERROR]   location: class Main
[compile] [ERROR] /app/src/main/java/Main.java:[42,30] cannot find symbol
[compile] [ERROR]   symbol:   variable argument
[compile] [ERROR]   location: class Main
[compile] [ERROR] -> [Help 1]
[compile] [ERROR] 
[compile] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[compile] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[compile] [ERROR] 
[compile] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[compile] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[compile] Looks like your code failed to compile.
[compile] If you think this is a CodeCrafters error, please let us know at hello@codecrafters.io.

Sorry, I found the problem solution

@Didar83 Do you mind sharing what was wrong? Would love to see if we can improve the tester / instructions.

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

I had a different implementation of the CD method, so if in the code examples you will provide the code of another class (Navigation.java), that would be clear

1 Like