日期:2014-05-20  浏览次数:20736 次

FileConnection在nokia真机上的问题.
请教一个FileConnection在nokia真机上的问题,程序实现的是往nokia手机上写一个txt文件.代码如下:
try
    {
      String   fileName= "aaa.txt ";
      String   root=FileSystemRegistry.listRoots().nextElement().toString();
      FileConnection   fc=(FileConnection)(Connector.open( "file:/// "+root+fileName));
      if(!fc.exists())   {
      fc.create();
      form.append( "create ");
      fc.setWritable(true);
      String   str= "for   test ";
      OutputStream   os=fc.openOutputStream();
      os.write(str.getBytes());
      os.close();
      }
      fc.close();
    }
    catch(Exception   e)
    {
    e.printStackTrace();
            form.append( "Err: "+e.toString());
    }
这段代码在模拟机上运行正常,但是在手机上在Connector.open()报IO异常.
请问各位大虾,有知道原因的吗?万分感谢!

------解决方案--------------------
应该是路径问题