private static URL fileToURL ( Path file ) { Path p ; try { p = file . toRealPath ( ) ; } catch ( IOException e ) { p = file . toAbsolutePath ( ) ; } try { return p . normalize ( ) . toUri ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { return null ; } }
Returns the directory or JAR file URL corresponding to the specified local file name .