HelloClient.class
HelloWorld.class
HelloWorldBean.class
HelloWorldBean_79kcn4_EOImpl.class
HelloWorldBean_79kcn4_HomeImpl.class
HelloWorldBean_79kcn4_Impl.class
HelloWorldHome.class
全部拷贝到客户端原来的HelloClientclient代码你需要做如下的改动。
改成
Properties env = new Properties(); 
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory"); 
env.put(javax.naming.Context.PROVIDER_URL,"iiop://yourjiqiming:port"); 
//javax.naming.Context initContext=new javax.naming.InitialContext(env);
Context initContext = new InitialContext(env); Object obj=initContext.lookup("HelloWorld"); //远程查找,由名字得到对应的对象。
RemoteHome home=(RemoteHome)javax.rmi.PortableRemoteObject.narrow(obj,RemoteHome.class);
RemoteInterface remote=home.create();
String receiveFromRemote=remote.message("Hello,Remote Object!"); //远程方法调用
System.out.println("Client Received From Remote Object: \""+receiveFromRemote+"\"");
重新编译javac *.java成功后。把这个新的类copy到其他的机器上
打入java -classpath %J2EE_HOME%\lib\j2ee.jar;.;HelloWorldClient.jar; Client