cancel
Showing results for 
Search instead for 
Did you mean: 

File not found, Missing resource bundle

Former Member
0 Kudos

Hi

I have a problem in accessing files (XML and Resource bundles) in Java projects. I used to access these files in WD Java. The same piece of code does not work here.

e.g. When I create a new file object by providing the path name I get a file not found exception. The file exists in my package and I call it this way:

File f = new File("file.txt"); then in an input stream but it doesnt work. However in a J2EE project the same code works.

Similarly the resouce bundle never seems to work even if I give the fully classified class name for the property file. I can access property files in WD Java with ease. I understand that the root path changes and hence the problem. How should I solve it? Is there an elegant way which makes it work in all cases? Please throw some light on the root path for these projects. Thank you.

regards

LNV

Edited by: vln on Jan 16, 2008 9:34 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

You should be using

<b>this.getClass().getResourceAsStream(filePath)</b>

which will return you an InputStream.

Check the JDK documentation for the respective methods in java.lang.Class and java.lang.ClassLoader.

HTH!

\-- Vladimir