resource files is being picked from user's desktop and not from jar file

Hi,

I have come across with a problem while running my application using web start.

I am having a .txt file in a jar file...and the link to this jar file has been specified in the jnlp file.

Now, i am loading the .txt file using this code :

ClassLoader cl = Thread.currentThread().getContextClassLoader();

InputStream releaseNumberInputStream = cl.getResourceAsStream(

"release_number.txt");

Now everything works as expected if there is no "release_number.txt" file present at the user's desktop in windows-xp OS. But when this txt file is present at the desktop, somehow this file is being picked up and not the one that is present in the jar file. Ideally, the resource file in the jar file should be loaded. Why this file is being picked up from the desktop first?

Please help me out on this.

Thanks,

gshankar

[883 byte] By [gshankar@ipolicynet.coma] at [2007-11-26 18:25:58]
# 1

I guess you have this resource stored at

the 'root' of the Jar archive?

One good way to solve the problem might

be to move it to somewhere more unique.

A common trick for putting resources in

"user.home", and ensuring they do not

overwite other resources (or vice versa)

is to put them in a sub-directory of the

reverse domain name, like classes.

So, for resources for 'physci.org', I might

look to put them in

"user.home"/org/physci/resource/TheResource.txt

Of course, if there is an 'org' folder on the

desktop, with a file with local path ..

./physci/rescource/TheResource.txt

..the problem might still occur, but it

is much less likely to happen.

AndrewThompson64a at 2007-7-9 6:00:02 > top of Java-index,Desktop,Deploying...