Java Web Start and preferences files

Y

yaaros

I have a problem with Eclipse RCP application that I try run over Java
Web Start. In one of the plugin's catalogs I have a files with codes
snippets that I try use in my application. Everything works great when
I open application through Eclipse or export to standalone product.
But when try it open using JWS I cannot access to the catalog with
snippets. I think that the problem is that the plugin's are packed to
jar files and the catalogs (templates) with snippets cannot be access
by those jar files beacuse its inside this archive.

Can anyone tell me how can I acces to the files archivied to jar file
with the rest of the code??
 
A

Andrew Thompson

Can anyone tell me how can I acces to the files archivied to jar file
with the rest of the code??

Assuming the resources are in a Jar on the application's
classpath, it is as simple as..
URL theResourcePath =
obj.getClass().getResource("/path/to/properties.prop");

'obj' can be any Object (or subclass) instance, but
getResource() might fail if it is called by the root class
loader.
 
Y

yaaros

(e-mail address removed) wrote:

..


Assuming the resources are in a Jar on the application's
classpath, it is as simple as..
URL theResourcePath =
obj.getClass().getResource("/path/to/properties.prop");

'obj' can be any Object (or subclass) instance, but
getResource() might fail if it is called by the root class
loader.


Ok that give me a url to resource but how can I read from this path.
When I using

catToRes.listFiles(new FileFilter(){
public boolean accept(File pathname) {
if (pathname.isFile() && pathname.getName().endsWith(".tpl"))
return true;
return false;
}
});

it's return me null?? I'm beginner in that field so please explain me
it as simple as it possible. I add that all files are XML format and I
have to read all of them from resource catalog.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top