This is not a Java question, but a windows / dos question.
The explanation boils down to the old dos command for switching drives.
Entering a drive letter followed by a colon is a command to change the disks in dos, so the `t20 command does nothing, since your working directory is already on drive C. The" directory "returned by the native JRE interface is the same as if you were using path "", that is, your working directory.
Add a slash, on the other hand, and this is the correct path to the root of your C drive, so your JRE gets this directory using its own interface.
If you go to the dos command (windows> run> cmd) and enter C:
you will see that it accepts the command, but does not change the directory, unless, of course, you are currently on a different drive.
hope this helps.
source share