diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/cli/EnvHelper.java b/daemon/src/main/java/org/mvndaemon/mvnd/cli/EnvHelper.java index 3ed9e3055..cfb83d81c 100644 --- a/daemon/src/main/java/org/mvndaemon/mvnd/cli/EnvHelper.java +++ b/daemon/src/main/java/org/mvndaemon/mvnd/cli/EnvHelper.java @@ -114,7 +114,7 @@ static void chDir(String workingDir) throws Exception { // change current dir for the java.io.File class Class fileClass = Class.forName("java.io.File"); if (JavaVersion.getJavaSpec() >= 11.0) { - Field fsField = fileClass.getDeclaredField("fs"); + Field fsField = fileClass.getDeclaredField(JavaVersion.getJavaSpec() >= 21.0 ? "FS" : "fs"); fsField.setAccessible(true); Object fs = fsField.get(null); Field userDirField = fs.getClass().getDeclaredField("userDir");