开发者

j2me fileconnection java.io.IOException: Root is not accessible

 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();

in the above code I m getting the following error:

   no exist
java.io.IOException: Roo开发者_StackOverflowt 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)

The file file:\\c:\myfile.txt exists. How do i go about now ?


Looks like you need to set the MIDLet Permissions.

Note you might get this working on the simulator but you will need signed code at least to get working on a real device.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜