Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Property-File outside of Jar?

 
Michael Veeck
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I have an application (packaged in a JAR-file) which needs to read in some properties from the file "db.properties"

Now I dont want to package the properties-file in the JAR-File because the user might want to change the props which would break the signature of the JAR.

But I cannot issue a call to getResource(...) on the main-class of the JAR (which only gets me a null-reference), all I can get is a reference to resources inside the JAR.

What am I doing wrong and what is the way to go here?

Thanx in advance
Veeck
 
Joseph Maddison
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could be missing something here, but have you already considered using the load and store methods of the Properties class? It looks like all you need to do is open the file and call Properties.load() with the InputStream.

HTH,
jdmaddison
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this...



Store the jar file and properties file in the same folder and execute the jar file. It will get the current folder, read the properties file and
do the needful......
[ January 29, 2005: Message edited by: Vijay Vaddem ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic