SE452: JNDI [2/18] ![]() ![]() ![]() |
JNDI - Java Naming and Directory Interface
Helps to integrate Java programs into their environment.
Independent of any directory implementation, so can use used to support DNS, NDS, LDAP, NIS
Context - A set of name to object bindings
Naming Systems and Namespaces - A connected set of Contexts
JNDI classes are in javax.naming.*
To use JNDI:
Context
InitialContext
, then lookup
others from there:
Context ctx = new InitialContext()
Printer printer = (Printer)ctx.lookup("treekiller");
printer.print(report);