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.

Multiple .properties loading from jar file

Thread view: 
vachacz - 06 Aug 2007 08:22 GMT
Hi !

I have a strange issue with .properties loading. I'm developing swing
application and i'd like to add internationalization. It doesn't
matter how i solved this issue, because it works ;) i have only one
problem ...

I need several .properties files. The amount can be dinamic, and i
want to load ResourceBundles at runtime.
First use case:
  - application start from $APP/app.jar
  - i have a direcotry $APP/i18n where property files are located
  - at runtime i list $APP/i18n files and load all bundles dinamicly

it works ... but for user simlicity i'd like to hide $APP/i18n into
$APP/app.jar (META-INF/i18n)

there is common mechanism for loading such resources
 - getClass().getResource("...");
 - getClass().getClassLoader().getResource("...");
i can load properties using such methods, but i don't know to list all
properties resources in current jar. is it possible to solve this
issue ?

thx for your help
Łukasz Wachowicz

ps: there's a solution to open $APP/app.jar programmatically. API to
list jar entries is avaliable, but it does not look like good
solution ...
Owen Jacobson - 06 Aug 2007 09:14 GMT
> Hi !
>
[quoted text clipped - 26 lines]
> list jar entries is avaliable, but it does not look like good
> solution ...

The obvious solution, to me, would be to have a single "root"
configuration file that lists the properties files to load, rather
than trying to detect all of them and determine which ones are the
ones you want.  Even a flat text file with one resource-relative
filename per line would work pretty well.

Best,
Owen


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.