import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
public class Delete {
public static void main(String[] args) throws Exception {
String initalContextString = "/tmp/marketing/reports";
if (args.length < 1) {
System.out.println("Usage: java Delete filename");
System.exit(-1);
}
System.out.println("This program assumes the context is " + initalContextString);
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:" + initalContextString);
Context initCtx = new InitialContext(env);
System.out.println("Attempting to unbind " + args[0]);
initCtx.unbind(args[0]);
System.out.println("Done.");
}
}
|