Java examples for JNDI:Name
Adding, Replacing, Removing, and Renaming a Binding in the Naming Service
import javax.naming.Context; import javax.naming.NamingException; public class Main { public static void main(String[] argv) { try {/*from w ww . ja v a2 s.co m*/ Context ctx = null; // Add a binding. ctx.bind("Name", new SampleObjectImpl()); // Replace a binding. ctx.rebind("Name", new SampleObjectImpl()); // Remove a binding. ctx.unbind("Name"); // Rename a binding. ctx.rename("Name", "NewSample"); } catch (NamingException e) { } } } class SampleObjectImpl{}