If we want to define a valid URL instance for a file we need to add the "file" protocol as in the following example:
URL url = new URL("file:///C:/photos/me.png");