Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading Files

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand there are limitations on accessing the native file system with MIDP, but will I have problems reading a local text file that I include with my JAR?
Thanks,
Drew
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's in the JAR, then it's also in the classpath.
You should be able to read the file as a resource (this should work regardless of whether it's in a JAR or not).
InputStream stream = getClass().getResoureAsStream("/yourfile.ext");
is one way to open an input stream on the resource.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic