[ACCEPTED]-File.toURL() deprecated?-io
Accepted answer
Use:
URL url2 = file.toURI().toURL();
0
I think the right answer to this question 5 is the one exposed in this link http://www.jguru.com/faq/view.jsp?EID=1280051
As exposed 4 in the link above, the right way to do this 3 is:
// Supposing f is the referenced file in code and we want to
// get an URL instance without deprecation warnings.
URL externalForm = f.toURI().toURL();
There is no catch for MalformedURLException 2 as the question is about deprecation of 1 the method file.toURL().
Hopes this helps.
i think that you must write the url in this 2 way
C:/Documents and settings/Administrator/...
not 1 in this
C:\Documents and settings\Administrator...
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.