import com.siemens.mp.io.file.FileConnection;
......
FileConnection fileconnection = null; try { fileconnection = (FileConnection) (Connector.open("file:///" + s)); } catch (IOException ex) { return null; } Enumeration ex = fileconnection.list("*",true);
......
想问一下,我这样弄,fileconnection总是似乎open不成功,导致fileconnection上的list之类的任何操作,除了toString(fileconnection.toString()的值是:com.siemens.mp.io.j2me.file.Protocol)都不成功,且连错误都无法捕获,直接终止了这段程序的执行,但不退出,而相同的代码,别的应用却跑得很好.
哪位朋友帮我啊.
没人知道吗?
捕捉倒错误可以打印出来呀 try { fileconnection = (FileConnection) (Connector.open("file:///" + s)); } catch (IOException ex) { ex.printStackTrace(); return null; }
这里是不出错的,在之后的fileconnection.list()这一些方法时出错,无法捕获错误.这是真正郁闷的地方.
做通配的时候应该Enumeration ex = fileconnection.list("*.*",true);
通配也是一样.把别人的代码拷过来都不行.真是晕死了.
|