Generate URL for File

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2010-05-07T14:21:44Z Indexed on 2010/05/07 14:28 UTC
Read the original article Hit count: 221

Filed under:

The default output of File.toURL() is

file:/c:/foo/bar

These don't appear to work on windows, and need to be changed to

file:///c:/foo/bar

Does the format

file:/c:/foo/bar

work correctly on Unix (I don't have a Unix machine to test on)? Is there a library that can take care of generating a URL from a File that is in the correct format for the current environment?

© Stack Overflow or respective owner

Related posts about java