Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar a project with property files in it external to jar

 
kiran kumar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
kiran kumar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaime Tovar for the reply. I have worked out that in a similar way.

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic