0

I've got some weird problem. I get access to my resources files like this:

File xmlFile = new File(getClass().getResource(xmlPath).getPath());

Where xmlPath is "/META-INF/file.xml".

When I run from Eclipse, everything works fine. Unfortunately, when I pack everything to jnlp file, upload with my web app on tomcat (from where I download all jar's by jnlp) it stops work.

When I run my jnlp, it downloads all jar's like it should and fails to start. Throwing this exception:

java.io.FileNotFoundException: C:\Users\A050868\Desktop\http:\address:port\webapp\downloads\lib\package.jar!\META-INF\componentContext.xml (The filename, directory name, or volume label syntax is incorrect)

How can I get access to my file, which is in resources/META-INF folder, in cached locale jar copy? For now it seems, like Java try get access to jar on server side - no this local, downloaded by jnlp.

Any ideas?

Kayne
  • 47
  • 1
  • 10
  • What are you trying to do? You cannot treat opaque paths like normals paths. – Boris the Spider Aug 07 '13 at 09:32
  • I wanted to modify some configuration paths for client downloaded by jnlp. At the end I download them, save on client drive and then edit them in way I wanted to. – Kayne Aug 26 '13 at 06:49

1 Answers1

0

All the files are packed together in your jnlp file. They don't to exist as individual files on filesystem when you port your package.

That said, they are available on the classpath. You can access the content of your package using the appropriate classloader.

getClass().getClassLoader().getResourceAsStream(...)

This may help you

Community
  • 1
  • 1
rocketboy
  • 9,573
  • 2
  • 34
  • 36
  • Yup, that's exactly what I figured out after few hours of searching. Finally I download content of this files, save on hard drive of client and then use them. No best solution, but works :) – Kayne Aug 26 '13 at 06:48