FileConnection c = (FileConnection) Connector.open("file:///c:/myfile.txt",Connector.READ_WRITE);
if (c.exists())
{
System.out.println("exist");
}
else {
System.out.println("no exist");
c.create();
}
OutputStream out = c.openOutputStream();
PrintStream output = new PrintStream( out );
output.println( response );
out.close();
c.close();
在上面的代码中,我收到以下错误:
no exist
java.io.IOException: Root is not accessible
at com.sun.midp.io.j2me.file.Protocol.ensureConnected(Protocol.java:1588)
at com.sun.midp.io.j2me.file.Protocol.ensureOpenAndConnected(Protocol.java:1604)
at com.sun.midp.io.j2me.file.Protocol.create(Protocol.java:945)
at hello.Midlet.traverse(Midlet.java:83)
at hello.Midlet.startApp(Midlet.java:40)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
at com.sun.midp.main.Main.runLocalClass(Main.java:466)
at com.sun.midp.main.Main.main(Main.java:120)
文件 file:\\c:\myfile.txt 存在。我现在该怎么走?