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
- Check writability of the target path: touch the file as the same user running Ant.
- Free disk space or raise the quota if the cause is ENOSPC.
- 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
- Make build/state directories user-owned and writable before starting Ant.
- Monitor free disk space on CI hosts; state-file writes are among the first ENOSPC victims.
- Never mix root and user builds in the same output tree.
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
- error reading property file
- CompileProperties failed.
- PropertiesParser failed.
- cannot close property file
- genstubs failed
AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14).
Data as JSON: /api/errors/236301f87ddf1a8b.
Report an issue: GitHub.