/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
Hashtable env=new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.facontext.RefFsContextFactory");
env.put(Context.PROVIDER_URL,"file:/tmp.tutorial");
try {
Context ctx=new InitialContext(env);
File f=(File) ctx.lookup("abc.txt");
System.out.println(f);
ctx.close();
} catch (NamingException e) {
System.out.println("LookUp the file is failed"+e);
}
}请问此程序运行的结果是什么样的, env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.facontext.RefFsContextFactory");
env.put(Context.PROVIDER_URL,"file:/tmp.tutorial");是起什么作用的,另外查找文件的目录是怎么样的,谢谢各位了!
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
Hashtable env=new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.facontext.RefFsContextFactory");
env.put(Context.PROVIDER_URL,"file:/tmp.tutorial");
try {
Context ctx=new InitialContext(env);
File f=(File) ctx.lookup("abc.txt");
System.out.println(f);
ctx.close();
} catch (NamingException e) {
System.out.println("LookUp the file is failed"+e);
}
}请问此程序运行的结果是什么样的, env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.facontext.RefFsContextFactory");
env.put(Context.PROVIDER_URL,"file:/tmp.tutorial");是起什么作用的,另外查找文件的目录是怎么样的,谢谢各位了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货