wood burning stoves 2.0*
The moose likes Java in General and the fly likes refering a property file in the manifest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "refering a property file in the manifest" Watch "refering a property file in the manifest" New topic
Author

refering a property file in the manifest

Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
I have a manifest file and have listed required jar files in the Class-Path of the Manifest file, this works fine. I am trying to refer a property file using Class-Path of the Manifest but it doesn't work. Please let me know if this is the correct way or is there any other approach.

Thanks in advance.
Babu
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

The classpath is a list of jar files and directories. So if what you tried was putting the name of the properties file in the classpath, then no, that wouldn't work. Putting the name of the directory which contains the properties file in the classpath would have a better chance of working.
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Thanks for you reply. I tried mentioning the directory name where the property file is located in the manifest file but it didn't work. Any other idea(s)?

Thanks again.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

If it were me, I would have a look at the code which tries to access the properties file next.
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Manifest-Version: 1.0
Main-Class: statusupdate.StatusUpdateEmail
Class-Path: lib/ojdbc14.jar lib/activation.jar lib/mail.jar lib/log4j.jar .

First I gave the full directory path where the property file is located later I changed mentioning a "." at the end of the class path in the manifest. (both options didn't work)

Directory structure:

log4j.properties
lib/ojdbc14.jar
lib/activation.jar
lib/mail.jar
lib/log4j.jar
myjar.jar


In the code do I need to use the class loader to load log4j.properties.

getClass().getClassLoader().getResourceAsStream("/log4j.properties");

I tried that option too, but no luck.
[ August 28, 2008: Message edited by: Venkat Babu ]
 
GeeCON Prague 2014
 
subject: refering a property file in the manifest