Hi all,

I wrote a MIDlet for storing an image in the nativefolder of a mobile(Nokia 6630) using FileConnection API.I am using WTK2.2.
When I tried to run it on the system, it is giving error.
unable to load Fileconnection API.

The code is


try {
FileConnection newDir = (FileConnection) Connector.open(currentRoot.getURL() + newDirURL,Connector.WRITE);

newDir.mkdir();

} catch (IOException e2)
{ e2.printStackTrace();
}
try {
FileConnection fconn = (FileConnection)Connector.open("file:///CFCard/"+tfSave.getString()+".png",Connector.WRITE);

if (!fconn.exists())
fconn.create(); // create the file if it doesn't exist
DataOutputStream dos = fconn.openDataOutputStream();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
DataOutputStream outputDataStream= new DataOutputStream(outputStream);
for(int i=0;i<bimg.nSingleDArray.length;i++)
{
outputDataStream.writeInt(bimg.nSingleDArray[i]);
}
outputDataStream.flush();

byte[] outputRecord = outputStream.toByteArray();
dos.write(outputRecord);
dos.flush();
dos.close();

fconn.close();
}
catch (IOException e1) { e1.printStackTrace();}