Mittwoch, 24. Oktober 2007

java.net.MalformedURLException: unknown protocol: c

This error message is quite hard to understand.
It often happens, when a File or it's path contains whitespaces. A quick solution is, to add "file:/" to the Filename.

For example:

String f = new String("test.xml");
// this can cause the error:
readFile(f); 
// this will work fine:
readFile("file:///"+f);

Keine Kommentare: