File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access text file using relative path in J2me with Eclipse Pulsar

 
Jayesh Pokar
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • 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
Project Structure
[Thumbnail for Untitled.png]
 
nishan satharasinghe
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try without res/ part in the path
 
Jayesh Pokar
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • 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?

 
Maneesh Godbole
Saloon Keeper
Posts: 10973
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic