I am using Windows 10, latest JDK.
System.out.println(new File("F:\\some\\path\\to\\file.wav").getAbsolutePath());
This prints:
F:\some\path\project_folder\F:\some\path\to\file.wav
!!!
Can you please explain what am I mistaking here? I tried even
new File(URI.create("file:///F:/some/path/to/file.wav"))
but gives me
/F:/some/path/to/file.wav
(a leading / makes it wrong)
Trying with only 2 slashes file://F:/some/path/to/file.wav
I get an exception
java.lang.IllegalArgumentException: URI has an authority component
UPDATE
This only occurs when I am referring to files in partition F:\
(by the way, the project itself is in F:\
also). Trying to refer to the C:\
which is the system drive, works normally.
UPDATE 2
Turns out that there are some parent directories shared between the file and project (F:\some\path\
in my example). Maybe this is the reason?!
I tried new File("..\\to\\file.wav")
but also printing wrong F:\some\path\project_folder\..\to\file.wav