A Context's environment is represented as a java.util.Hashtable or any of its subclasses (e.g., java.util.Properties). It is typically specified using an argument to the InitialContext , InitialDirContext , or InitialLdapContext constructors, and augmented with data from other sources. They are inherited from the parent context as context methods proceed from one context to the next. For example, the following code creates an environment consisting of two security-related properties and creates an initial context using that environment. Hashtable env = new Hashtable(); env.put(Context.SECURITY_PRINCIPAL, "Rajanikant"); env.put(Context.SECURITY_CREDENTIALS, "Admin"); Context ctx = new InitialContext(env); Contexts that are looked up or otherwise derived from this initial context will have these two properties in their environment. A Context's environment can be examined using Context.getEnvironment() . Note : All environment properties are meaningful to all contexts. Those that are not meaningful are ignored by the context but inherited by derived contexts.