On Mar 23, 2010, at 4:27 PM, Qingmai Wang wrote: > String path = file.getPath(); > path = path.replaceAll("\\\\", "/"); > String uri = "file:///" + path; BTW, don't do this. It makes your code fragile and not portable. Instead use file.toURI();