There seems to be a difference in the way the path is specified in Java.
For example, if the file path is specified as file:/C:/DEV/test.txt , then
File f = new File(filename); f.exists();
will return false . The path may work in Explorer or in the browser, but it is a URL, not an absolute path to the file.
But, on the other hand, if the file path is specified as C:/DEV/test.txt , then
File f = new File(filename); f.exists();
will return true because the path is not a url but an absolute path.
With the Spring Framework , which is what ResourceUtils.getFile(filename) does - where the name can be either a URL or an absolute file path.
Garima Bathla Feb 14 2018-12-12T00: 00Z
source share