As a part of a high quality outreach, some adjustments are coming within the deliberate Java 25 launch with regard to file operations on Home windows. The File.delete
command will now not delete read-only information on Home windows, and file operations on a path with a trailing area in a listing or file title will now fail persistently on Home windows.
In a June 16 bulletin on Oracle’s inside.java weblog, David Delabassee, Oracle director of Java relations, mentioned File.delete
in JDK 25 has been modified on Home windows so it now fails and returns false
for normal information when the DOS read-only attribute is ready. Earlier than JDK 25, File.delete
would delete read-only information by eradicating the DOS read-only attribute earlier than deletion was tried. However as a result of eradicating the attribute and deleting the file should not a single atomic operation, this might outcome within the file remaining, with modified attributes. Purposes that rely on the earlier habits ought to be up to date to clear the file attributes earlier than deleting information, Delabassee mentioned.
To make the transition simpler, a system property has been launched to revive the earlier habits. Working File.delete
with -Djdk.io.File.allowDeleteReadOnlyFiles=true
will take away the DOS read-only attribute previous to deleting the file, restoring the legacy habits.