我找到答案了
我的代码如下
try{
Context ctx = new InitialContext();
Object obj=ctx.lookup(args[0]);
System.out.println(obj);
}catch(Exception e){}
执行命令如下:
java -Dorg.omg.CORBA.ORBInitialHost=kknd97(我的计算机名) -Dorg.omg.CORBA.ORBInitialPort=1050(j2ee服务器的端口) -classpath c:\j2ee\lib\j2ee.jar; 我的class文件名 我要查找的jndi名称