| Author |
access text file using relative path in J2me with Eclipse Pulsar
|
Jayesh Pokar
Greenhorn
Joined: Apr 26, 2011
Posts: 10
|
|
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...
|
| Filename |
Untitled.png |
Download
|
| Description |
Project Structure |
| Filesize |
8 Kbytes
|
| Downloaded: |
5 time(s) |
|
 |
nishan satharasinghe
Greenhorn
Joined: Aug 27, 2008
Posts: 14
|
|
|
try without res/ part in the path
|
 |
Jayesh Pokar
Greenhorn
Joined: Apr 26, 2011
Posts: 10
|
|
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?
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 7602
|
|
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
|
[Donate a pint, save a life!] [How to ask questions]
|
 |
 |
|
|
subject: access text file using relative path in J2me with Eclipse Pulsar
|
|
|