I have standalone Java application ,in that i have various modules
Application starts from one classes main() method and then application goes on.
Now i wanted share variables in form of key/value pair to various modules
How can i do it ?
Update :
From main() which kicks on application , from there i will be setting some variables.
and also from here it starts some modules programs ,
I just want similar functionality like ServletContext , SessionContext variables , just like in Servlet container
If you’re looking for JVM wide simple string based key/value configuration storage then the system properties are usually a good fit: http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
Anywhere in your code you can use:
Also,
System.getProperties()provides a map like set of properties (it extendsHashtable).