Java File URI error ?
- by Frank
I need to get a file object online, and I know the file is located at : http://nmjava.com/Dir_App_IDs/Dir_GlassPaneDemo/GlassPaneDemo_2010_04_06_15_00_SNGRGLJAMX
If I paste it into my browser's url, I'll be able to download this file, now I'm trying to get it with Java, my code looks like this :
String File_Url="http://nmjava.com/Dir_App_IDs/Dir_GlassPaneDemo/GlassPaneDemo_2010_04_06_15_00_SNGRGLJAMX";
Object myObject=Get_Online_File(new URI(File_Url));
Object Get_Online_File(URI File_Uri) throws IOException
{
return readObject(new ObjectInputStream(new FileInputStream(new File(File_Uri))));
}
public static synchronized Object readObject(ObjectInput in) throws IOException
{
Object o;
......
return o;
}
But I got the following error message :
java.lang.IllegalArgumentException: URI scheme is not "file"
at java.io.File.<init>(File.java:366)
Why ? How to fix it ?
Frank