Why did the toURL() method of File get deprecated in Java 6? Should I stop using it now.

The toURL() method of File does not properly escape characters that aren't valid in a URL. You can write better code today without waiting for Java 6 by calling the toURL() method after calling toURI() on a File object: