Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Resource Bundles outside of JARs

Reply
Thread Tools

Resource Bundles outside of JARs

 
 
success_ny@yahoo.com
Guest
Posts: n/a
 
      03-17-2005
I would like to package my Java application (executable, not J2EE or
web) in a JAR and not package my resource bundle properties file in a
JAR. My reasoning is as follows: one of the reasons I use resource
bundle as a .properties file is that it makes it easy to make changes
to certain properties dynamically at run-time without recompiling the
application. Especially if the application is in production, any
changes to the JAR would be complicated. So, ideally I would like my
resouce bundle properties file to reside separately from the JAR where
the code is packaged so I can change, say, flag settings (like, enable
debugging at run-time) or make other changes without touching the JAR.
Does it make sense? How do I load Resource Bundle if it just resides on
the file system and is not part of JAR efficiently?

Thank you!

 
Reply With Quote
 
 
 
 
Oscar kind
Guest
Posts: n/a
 
      03-17-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I would like to package my Java application (executable, not J2EE or
> web) in a JAR and not package my resource bundle properties file in a
> JAR.


This is not difficult. Resources don't have to be in a .jar file; they
just have to be in the classpath. Add a Class-Path header to the manifest
for ".", and the resource files may also be located in th same directory
as the .jar file.


--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website

PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
 
Reply With Quote
 
 
 
 
Ferenc Hechler
Guest
Posts: n/a
 
      03-17-2005
you can add an entry like
[---]
Class-Path: .
[---]
to the manifest file of your jar and put the property-files in the folder
you started the jar from.
This is equivalent to starting your jar with the option "-classpath .".


<(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed) oups.com...
>I would like to package my Java application (executable, not J2EE or
> web) in a JAR and not package my resource bundle properties file in a
> JAR. My reasoning is as follows: one of the reasons I use resource
> bundle as a .properties file is that it makes it easy to make changes
> to certain properties dynamically at run-time without recompiling the
> application. Especially if the application is in production, any
> changes to the JAR would be complicated. So, ideally I would like my
> resouce bundle properties file to reside separately from the JAR where
> the code is packaged so I can change, say, flag settings (like, enable
> debugging at run-time) or make other changes without touching the JAR.
> Does it make sense? How do I load Resource Bundle if it just resides on
> the file system and is not part of JAR efficiently?
>
> Thank you!
>



 
Reply With Quote
 
Oscar kind
Guest
Posts: n/a
 
      03-18-2005
Ferenc Hechler <(E-Mail Removed)> wrote:

> This is equivalent to starting your jar with the option "-classpath .".


Alas, this is not generally true: when you start a .jar file with the -jar
switch, any classpath settings outside the .jar file are ignored.


--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website

PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
 
Reply With Quote
 
success_ny@yahoo.com
Guest
Posts: n/a
 
      03-23-2005
So let me make my question specific and clear: if I call my java
program from a command line supplying CLASSPATH like this (on Unix):

CLASSPATH=.:$CLASSPATH:$JARS_HOME:$JARS_HOME/j2ee.jar:MyApp.jar
java -classpath com.blah.MainProgram

Then I can put the myResources.properties file in that same JARS_HOME
directory and call it from the Java like this:

myResourceBundle = ResourceBundle.getBundle("myResources",
Locale.ENGLISH);

That does not work!

Any ideas how to make it work?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add *.jars to *.jars possible/recommendend? Eclipse setup for this? Ulf Meinhardt Java 2 02-03-2010 04:11 PM
cross-jars resource bundles Marco Java 4 10-14-2009 06:38 PM
Loading image from jars from other jars etc JavaEnquirer Java 2 02-22-2006 03:42 PM
JARs containing JARs alan@engrm.com Java 5 05-19-2005 04:55 PM
exec jars w/dependent jars Ike Java 6 09-24-2004 06:03 PM



Advertisments