Here you can find the source of pathToURLs(String path)
public static URL[] pathToURLs(String path) throws MalformedURLException
//package com.java2s; /* /*from w w w . jav a 2 s. co m*/ * @(#)StringUtil.java 1.0 2004-10-11 * * Copyright 2005 UFIDA Software Co. Ltd. All rights reserved. * UFIDA PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.StringTokenizer; public class Main { public static URL[] pathToURLs(String path) throws MalformedURLException { StringTokenizer st = new StringTokenizer(path, File.pathSeparator); URL[] urls = new URL[st.countTokens()]; int count = 0; while (st.hasMoreTokens()) { File file = new File(st.nextToken()); URL url = null; url = file.toURI().toURL(); if (url != null) { urls[count++] = url; } } if (urls.length != count) { URL[] tmp = new URL[count]; System.arraycopy(urls, 0, tmp, 0, count); urls = tmp; } return urls; } }