The problem is that /usr/lib/jvm//jre is a symlink to ".." java.nio.file.FileSystemLoopException: /usr/lib/jvm/java-17-openjdk/jre at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:295) at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:374) at java.base/java.nio.file.Files.walkFileTree(Files.java:2845) at FileSystem.copyDirectory(build.java:1641) at build.main(build.java:83) --- a/build.java +++ b/build.java @@ -1638,7 +1638,7 @@ CopyVisitor copyVisitor = new CopyVisitor(source, destination); try { - Files.walkFileTree(source, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, copyVisitor); + Files.walkFileTree(source, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, copyVisitor); } catch (IOException e) {