Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Java Web Start and preferences files

Thread view: 
yaaros@gmail.com - 16 Aug 2007 12:08 GMT
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??
Andrew Thompson - 16 Aug 2007 12:56 GMT
...
>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.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

yaaros@gmail.com - 16 Aug 2007 13:06 GMT
> yaa...@gmail.com wrote:
>
[quoted text clipped - 16 lines]
>
> Message posted viahttp://www.javakb.com

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.
Roedy Green - 22 Aug 2007 12:17 GMT
>Can anyone tell me how can I acces to the files archivied to jar file
>with the rest of the code??

see http://mindprod.com/jgloss/resource.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.