Forums Register Login

Jar a project with property files in it external to jar

+Pie Number of slices to send: Send
I have a java class which reads some properties from a property file(which contains database server urls username and passwords).I want
to jar the class file and give it to the some other project so that they can just change the properties file if needed and use the jar file in their project . When i make the jar file ,i see that the property file is inside the jar file and is not user freindly to modify.
I would appricate if someone could help me to know ,
"How can we make a jar file so that its properties file are exteranal to jar".
+Pie Number of slices to send: Send
They can put you properties file in their own classpath. You have something like this.
/lib/Class1.class
/lib/Class2.class
/lib/Class3.class
/lib/config.properties

Your clients have something like this.
/new/ClassA.class
/new/ClassB.class

Then you jar all your .class files in lib.jar. (without the config.properties)

So your clients want to use your libraries. They can do something like this.
Import/add to classpath your lib.jar
Add a config.properties to their project so it looks like this:
/new/ClassA.class
/new/ClassB.class
/lib/config.properties

They can now jar their project including .class and .properties into new.jar and deploy both lib.jar and new.jar.

I hope it helps
[ September 25, 2007: Message edited by: Jaime Tovar ]
+Pie Number of slices to send: Send
Thanks Jaime Tovar for the reply. I have worked out that in a similar way.

thanks
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2389 times.
Similar Threads
adding a property file to a jar
Defining Ant build.xml java properties files for a run targer
Properties questions
Problem while executing jar file
propertiest file and xml file, change after build application
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:39:51.