AI Creator's Path News: Java 25 changes Windows file operations! Addresses read-only file deletion and trailing space issues. A must-see for developers! #Java25 #Windows #For developers
Video explanation
A slight change in the Java world? Is it true that file operations on Windows will be updated?
Hello everyone! I'm John, here to answer your questions about the complex world of technology. Behind the scenes of the computers and smartphones we use every day, there are many programs working hard. Today, I'd like to introduce one of the most common "languages" for creating such programs:Java We will bring you small but important news related to .
Some of you may be wondering, "What is Java?" Java is a programming language that is used in a wide variety of places, from the systems behind websites to the apps on your Android smartphone, and even the important systems of large companies. Even Java is updated from time to time to make it better.
And now, the new "Java 2024" scheduled to be released in September 9 will have some changes to how Java programs handle files, especially on Windows computers. Sounds complicated? Don't worry, as always, I'll explain it in an easy-to-understand way!
Change 1: Will Java no longer be able to delete "read-only files" automatically?
The first change is how files that are set as "read-only" are handled.
What is a "read-only file"?
As the name suggests, this is a file that can be read (viewed), but is protected so that the contents cannot be rewritten or deleted accidentally. Important configuration files and the like may be protected from this.
In the past, Java...
In previous versions of Java, the program would say "Delete this file!" (technical term File.delete
This is a command to delete a file, and even if the file is "read-only," Java will be smart enough to temporarily disable the "read-only" setting before deleting the file. That's clever! But there's actually a small catch here.
What was the problem?
The process of "removing read-only protection" and "deleting a file" are processed as separate steps inside Java. Therefore, although it is very rare, if the deletion does not work properly for some reason (such as a timing issue) immediately after removing the read-only protection, it can happen that the file that is no longer read-only (i.e. the protection is removed) remains undeleted. This is an unintended result.
What's different from Java 25?
Therefore, in the new Java 25, the delete command (File.delete
) is issued,Java will no longer automatically remove read-only permissions.Instead, it displays information indicating the operation failed, such as "This file is read-only and cannot be deleted."false
This is safer and more honest behavior.
For developers who say, "I really prefer the old behavior!"
Of course, there may be programs that were created based on the previous behavior. For such developers, we will introduce special settings (called system properties) when running Java.-Djdk.io.File.allowDeleteReadOnlyFiles=true
It seems that by specifying the spell, it is possible to go back to the previous behavior of removing the read-only attribute before deleting. It's good that flexibility is still available!
Change 2: Become stricter about trailing spaces in file and folder names!
The second major change is how spaces (blank characters) that can easily end up in file or folder names are handled.
What is the last space?
For example, this is when a space is inserted at the end of a file or folder name, such as "Important Documents." Sometimes it's hard to notice just by looking at it.
"Last space" is a bit of a problem on Windows
In fact, Windows OS (the basic software that runs your computer) often does not treat a space at the end of a file or folder name as part of the official name. It's a bit of an unusual rule. Because of this, when a Java program tries to create or operate a file or folder with a name that ends with a space, it can sometimes behave in an unintended way.
In the past, Java...
In previous versions of Java, when you tried to operate on a file with an "invalid name with a space at the end," it would "appear to be successful" in the program, even though it should not have worked according to Windows rules. For example, the command to create a folder (File::mkdir
Even though the folder is not actually created, the program does not correctly report "failed" or the command to create a new file (File::createNewFile
etc.) would not show an error when it should have, which could cause problems later.
What's different from Java 25?
Starting with Java 25, if you try to use a path with a space at the end (like an address that shows the location of a file) to perform file operations on Windows,It consistently reports errors and failures saying "That name can't be handled by Windows"It looks like
In particular,
- A command to create a folder (
File::mkdir
etc.) properly means "failure"false
It will return the value: - A command to create a new file (
File::createNewFile
) are "input/output errors" (technical termIOException
This causes a problem called a "disturbance."
This allows programmers to quickly realize, "Oh, this naming method won't work on Windows," making it easier to create more stable programs.
Why is this change being made?
According to Oracle, the developer of Java, these changes are:Quality Outreach" It's part of that. Sounds pretty cool!
In other words, it's an improvement to make Java more predictable and stable, in line with Windows rules, when it runs in a specific environment such as Windows. It may sound like a simple thing, but it's very important for Java, which is the foundation of many programs.
When is Java 25 coming?
"Java 25," which includes the changes introduced this time, will be provided in the form of "JDK 25." "JDK" stands for Java Development Kit, and can be thought of as a set of tools for developing programs in Java.
And this JDK 25,"LTS (Long-Term Support) Release"In other words, it will be offered as a "long-term support version." The LTS version is a mark that security updates will be provided for a long period of time, so to speak, "This is a version that can be used for a long time with peace of mind." For many companies and developers, the LTS version is an important option.
The release date you are interested in is2024/9/16 It's almost here!
A word from John
What do you think of these changes to Java?
It may not be a big change that end users can directly feel every day, thinking, "Wow, the movement of files has changed!" But it's a behind-the-scenes improvement that makes the countless software and services made with Java more stable and work more correctly. I was reminded that these careful improvements, one by one, increase the reliability of the technology that supports our digital lives.
This article is based on the following original articles and is summarized from the author's perspective:
Java 25 to change Windows file operation behaviors