properties file in a jar

F

frank

I was wondering is there any issues with having a common package have
it's property file also contained in it's jar file? I'm having a
problem with it finding it when using that jar file in another
application that uses that common package. It finds the classes in that
jar for compiling but not the property file for some reason. Paths seem
to be correct from what I can see in the jar file.

Thanks,

Frank
 
F

frank

A follow-up question

I have a jar file that looks like this from contents stand point

c:> jar vtf csdsutility.jar
0 Mon Oct 24 10:04:58 EDT 2005 META-INF/
71 Mon Oct 24 10:04:58 EDT 2005 META-INF/MANIFEST.MF
2633 Fri Oct 21 17:04:44 EDT 2005 csds/utility/JavaLogging.class
1621 Fri Oct 21 17:04:42 EDT 2005 csds/utility/Logging.class
868 Fri Oct 21 17:04:42 EDT 2005 csds/utility/LoggingMethod.class
3204 Fri Oct 21 17:04:44 EDT 2005 csds/utility/TestLogging.class
3004 Fri Oct 21 17:04:44 EDT 2005 csds/utility/Utility.class
1142 Fri Oct 21 17:04:44 EDT 2005 csds/utility/WSLogging.class
83 Tue Jul 26 21:59:26 EDT 2005 csds/utility/javalogging.properties

If I include the jar file above in some other program it should find the
javalogging.properties file correct? It's failing in the common code
trying to find the properties file. I created a small driver that tests
the common code and it is fine it just does not work off the jar file.
Is there something weird about jar files and property files I don't know
about? I thought when you included them on the java -classpath line it
was like that code was part of your application and the path followed also.



Thanks,

Frank
 
R

Roedy Green

I was wondering is there any issues with having a common package have
it's property file also contained in it's jar file?

Some problems, which are far from insurmountable, are:

1. making sure you name it properly with the package, case sensitive,
as the path name.

2. making sure you remember to include it in the jar, and that any
client of your class remember to include it in their jars. that
include your class. It won't be included automatically, even by
Genjar. See http://mindprod.com/jgloss/cramfull.html
for a way around that.

3. if you only sometimes need it, it will be downloaded anyway. If
only sometimes need it, put the resource in an aux jar with the
manifest in them main jar class-path referring to it.

4. If you change the properties frequently, you have to keep
rebuilding and resigning the jar. Further, all those changes screw up
any jar caching forcing the whole jar to be reloaded over and over.
 

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,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top