Hai Friends,

Iam using J2ME , i can read a text file from jar (in res folder) by using

InputStream is = getClass().getResourceAsStream("help.txt");
StringBuffer sb = new StringBuffer();
int chars, i = 0;
while ((chars = is.read()) != -1){
sb.append((char) chars);
return sb.toString();
}catch (Exception e){}

but i want write a data to the text file, i doknow how to write please any one help me for this problem.

Edited 3 Years Ago by happygeek: fixed formatting

Writing to file in JAR archive is not possible, only reading is allowed. I'm not sure what you are doing, as what you trying to write/store, but you have generally two options

  1. Record Management System - RMS that is essentially mini database
  2. PDA Optional Packages is JSR 75 that late you use FileConnection object, but this is often used for remote access (URL/OBEX/Bluetooth)

Have you found the answer yet??


Edited 3 Years Ago by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.