openjdk/jdk · error · BuildException

error writing property file

Error message

error writing property file

What it means

Thrown by SelectToolTask.writeProperties when storing the tool-selection Properties raises an IOException — the task cannot persist its state file. The cause IOException identifies the underlying failure (disk full, permission denied, directory creation failed).

Source

Thrown at make/langtools/tools/anttasks/SelectToolTask.java:290

                    }
                }
            }
        }
        return p;
    }

    void writeProperties(File file, Properties p) {
        if (file != null) {
            Writer out = null;
            try {
                File dir = file.getParentFile();
                if (dir != null && !dir.exists())
                    dir.mkdirs();
                out = new BufferedWriter(new FileWriter(file));
                p.store(out, "langtools properties");
                out.close();
            } catch (IOException e) {
                throw new BuildException("error writing property file", e);
            } finally {
                if (out != null) {
                    try {
                        out.close();
                    } catch (IOException e) {
                        throw new BuildException("cannot close property file", e);
                    }
                }
            }
        }
    }

    String getDefaultArgsForTool(Properties props, ToolChoices tool) {
        if (tool == null)
            return "";
        String toolName = tool.toolName;
        return toolName.equals("") ? "" : props.getProperty(toolName + ".args", "");
    }

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Check writability of the target path: touch the file as the same user running Ant.
  2. Free disk space or raise the quota if the cause is ENOSPC.
  3. Correct ownership of the build directory (chown -R) after mixed-user builds.
Defensive patterns

Strategy: validation

Validate before calling

// before storing: verify the destination is creatable/writable
File dir = file.getParentFile();
if (dir != null && !dir.exists() && !dir.mkdirs())
    throw new BuildException("cannot create " + dir);
if (file.exists() && !file.canWrite())
    throw new BuildException("not writable: " + file);
// optional disk-space sanity check on the target partition
if (file.getUsableSpace() < 1024 * 1024)
    throw new BuildException("low disk space on " + file);

Try / catch

try {
    writeProperties(file, p);
} catch (BuildException e) {
    if (e.getCause() instanceof java.io.IOException ioe)
        throw new BuildException("cannot persist tool selection to " + file + ": " + ioe.getMessage(), ioe);
    throw e;
}

Prevention

When it happens

Trigger: The select-tool task finishing and attempting p.store() when the parent directory cannot be created by mkdirs(), the file is not writable, or the disk is full.

Common situations: Read-only checkout of the JDK forest; build dir owned by another user after running a build under sudo; disk quota exceeded on CI.

Related errors


AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14). Data as JSON: /api/errors/236301f87ddf1a8b. Report an issue: GitHub.