• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

access text file using relative path in J2me with Eclipse Pulsar

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am beginner in j2me and I am trying to access one text file but was unable to do it.

I am trying to access in this way

InputStream is=this.getClass().getResourceAsStream("res/test.txt");

Eclipse Project Structure
MyApp
- src
- res
-test.txt

I saw build path and res folder is included.

Please tell me the solution......Thanks...
Untitled.png
[Thumbnail for Untitled.png]
Project Structure
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try without res/ part in the path
 
Jayesh Pokar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Nishan for reply.....

I tried with /filename and it works fine.

By specifying path in this way is what we are telling start looking for file from root, am i right?

So it will first look into src folder and then to res folder and so on, wherever it finds the file it take that file.

I want to specify look only into res folder, and I am not able to do that.

I tried with...
res/filename
/res/filename
./res/filename

where I am wrong?

 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh Pokar wrote:
I tried with /filename and it works fine....
I want to specify look only into res folder, and I am not able to do that.

I tried with...
res/filename
/res/filename
./res/filename



You already it correctly.
The res directory is designed for all your resources such as media and property files. Of course you can have nested directories such as res/properties or res/images etc
 
Yeah, but is it art? What do you think tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic