Changed file.toURL to file.toURI to avoid encoding issue.