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();
try{
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.

Recommended Answers

All 3 Replies

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??

Thanx

Have you found the answer yet??

Thanx

It is not possible!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.