import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
public class Main {
public static void main(String[] argv) throws Exception {
String url = "iiop://localhost/";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, url);
Context ctx = new InitialContext(env);
// Create a subcontext.
Context childCtx = ctx.createSubcontext("child");
// Destroy the subcontext.
ctx.destroySubcontext("child");
Context obj = (Context) childCtx.lookup("grandChild");
String fullname = obj.getNameInNamespace();
}
}