Answer the question
In order to leave comments, you need to log in
Java. Where is the getCanonicalFile method in the new IO???
In the old method, you could get the full ( absolute ) path of the current directory:
new File(".").getCanonicalPath(); // абсолютный путь
// если есть переменная типа File то:
file.getCanonicalPath();
new File(".").getCanonicalFile().toPath()(); // абсолютный путь
// если верху где-то переменная типа Path то:
path.toFile().getCanonicalPath()
Answer the question
In order to leave comments, you need to log in
The official doc says to use Path.toRealPath or Path.normalize instead of File.getCanonicalPath or File.getCanonicalFile
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question