When we create a path that's relative to the current working folder, the path should not start with the file delimiter. If the current folder is named books and is under the C root, then the absolute path that's returned by the following snippet of code will be C:ookslearningpacktJavaModernChallenge.pdf:
Path path = Paths.get("learning/packt/JavaModernChallenge.pdf");
Path path = Paths.get("learning", "packt/JavaModernChallenge.pdf");
Path path = Path.of("learning/packt/JavaModernChallenge.pdf");
Path path = Path.of("learning", "packt/JavaModernChallenge.pdf");
Path path = FileSystems.getDefault()
.getPath("learning/packt", "JavaModernChallenge.pdf");
Path path = FileSystems.getDefault()
.getPath("learning/packt/JavaModernChallenge.pdf");