首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

j2me的moto开发,文件浏览模块无法连接到文件,无法创建文件,该怎么处理

2012-01-16 
j2me的moto开发,文件浏览模块无法连接到文件,无法创建文件似乎C:\ProgramFiles\Motorola\MotorolaJavaMESD

j2me的moto开发,文件浏览模块无法连接到文件,无法创建文件
似乎C:\Program   Files\Motorola\Motorola   Java   ME   SDK   v6.2   for   Linux   OS   Products\EmulatorM.3\devroot目录是模拟器的根目录,为了与手机真实目录相同,于是此目录下手动创建了文件夹phone和SD两目录,并在SD目录下创建了test.txt文件.结果执行下面代码时连接不到文件:
try   {
            fconn=(FileConnection)   Connector.open( "file://localhost/SD/test.txt ");
            if   (!fconn.exists())   {
                Alert   alert   =   new   Alert( "Error ",   "file   does   not   exist ",   null,
                                                                AlertType.ERROR);
                alert.setTimeout(Alert.FOREVER);
                dis.setCurrent(alert);
                mess   =   mess.concat( "file   does   not   exist; ");
                fconn.create();
            }
}
catch(exception   e){System.out.println(e.toString());}
模拟器上跳出Alert:file   does   not   exist手机上却可以正常找到文件建立连接.

fconn.create();函数也未成功.
是不是调用Connector.open函数时的参数路径不对????
如果是,那么该怎么设置模拟器的路径

[解决办法]
路径错了file:///SD/test.txt这样试试

热点排行