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

File Reading using J2ME

 
Bhanu Peruvemba
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to read a .wav/.txt file in J2ME using the following code

InputConnection connStream = (InputConnection) Connector.open( "file:///C:/abc.txt", Connector.READ );

and I get a ConnectionNotFoundException. I would like to know where should I be storing the abc.txt file. Could I store it in any directory on my C:\ drive or should I put it in a particular directory. I am using Eclipse and Sun's WTK.

Does Sun's WTK support file protocol.


Thanks in advance
bhanu
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Which version of the WTK are u using...It must be 2.2 to support FileConnection.
Also you will get a FileConnection from the scheme "file://".

HTH
Ahmad Khan
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InputStreamReader isr = new InputStreamReader(this.getClass().getResourceAsStream(/a.txt));

put your a.txt in your res directory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic