mrigank
asked on
Properties between two applications
Hi
I will be dividing my application into two domains. The first is the core.jar that will have some core classes. It will have its own properties file from which it will read the properties for various actions.
Now my second jar, applications.jar will be built upon core.jar. I will use only the jar of the core.
I want to modify the properties which get set in the core.jar file. How should i go about doing it.
One way is i can have a properties file outside my core.jar in a fixed path which the core.jar reads to set the propertoes. But this gives a very tight coupling between the jar and the loation of the file.
Is there any other way to go about doing it ?? I hope that i have made myself clear.
Thanks
Mrigank
I will be dividing my application into two domains. The first is the core.jar that will have some core classes. It will have its own properties file from which it will read the properties for various actions.
Now my second jar, applications.jar will be built upon core.jar. I will use only the jar of the core.
I want to modify the properties which get set in the core.jar file. How should i go about doing it.
One way is i can have a properties file outside my core.jar in a fixed path which the core.jar reads to set the propertoes. But this gives a very tight coupling between the jar and the loation of the file.
Is there any other way to go about doing it ?? I hope that i have made myself clear.
Thanks
Mrigank
ASKER
actually my core.jar will be used by various applications. So the core will have its own properties file inside the jar but the applications should be able to change those properties using a separate file.
But having the properties file which might be updated within a Jar is not a good idea.
In those scenerios, you can prefer DB to hold the updatable values.
In those scenerios, you can prefer DB to hold the updatable values.
ASKER
yeah thats the point. I should not update the properties inside the jar. but can i have a file outsude the jar which overrides the properties inside the jar ????
i suggsted the use of a db but people do not like it :(
i suggsted the use of a db but people do not like it :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ya, u can have the properties files outside of the jar but the folder structure should be maintained. If u have the properties in the exact folder outside of the jar, that will be used and the properties inside the jar will be discarded.
Regards,
Siva
Regards,
Siva
ASKER
that is the problem .. having to maintain the folder structure ... which is a pain at times .. because my code will then search for that structure .. not in a generic format ...
though another way is to have the file in the classpath ..
though another way is to have the file in the classpath ..
don't keep it in the classpath. Better would be give the complete path as system property then.
-Dapp.properties=/usr/muru ga/hello.p roperties
-Dapp.properties=/usr/muru
>>that is the problem .. having to maintain the folder structure ... which is a pain at times .. because my code will then search for that structure .. not in a generic format ...
>>
I don't understant. What do you mean "which is a pain at times .. because my code will then search for that structure"?
>>
I don't understant. What do you mean "which is a pain at times .. because my code will then search for that structure"?
All your core things in a jar (utilities). The domain stuffs in another Jar. That way, you will be using a single properties file.
So all your update calls will goto a single place.
If it is two different JVM's just let me know how are you sharing a single property file across two different JVM's when both are at different (remote) locations.
Regards,
Muruga