呵呵,推荐你一个小软件Active ports,可以看到根多的端口占用。比netstat -an看到更多
老外写的软件,主页好像是www.ntutility.com
老兄搞的很深入啊,自己编译stub,佩服,学习

解决方案 »

  1.   

    给你一个例子:
        远程接口:HelloWorld.java
        import java.rmi.Remote;
        import java.rmi.RemoteException;
        public interface HelloWorld extends Remote
        {
    public String sayHelloWorld() throws RemoteException;
        }
        远程对像:HelloWorldImpl.java
        import java.rmi.RemoteException;
        import java.rmi.server.UnicastRemoteObject;
        public class HelloWorldImpl extends UnicastRemoteObject implements HelloWorld
        {
    public HelloWorldImpl() throws RemoteException
    {
    super();
    }
    public String sayHelloWorld() throws RemoteException
    {
    return "Hello World";
    }
         }
         服务端:Server.java
         import java.rmi.registry.LocateRegistry;
         import java.rmi.registry.Registry;
         import javax.naming.InitialContext;
         public class Server
         { public static void main(String[] args)
    {
    try
    {
    LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
    HelloWorldImpl server=new HelloWorldImpl();
    new InitialContext().bind   ("rmi://localhost/sayHelloWorld",server);
    System.out.println("Server Started");

    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
     }
            }
            客户端:Client.java
            import javax.naming.InitialContext;
            public class Client
            {
               public static void main(String[] args)
                {
                    try
                       {
                         HelloWorld client=(HelloWorld)new InitialContext().lookup("rmi://localhost/sayHelloWorld");
                         System.out.println(client.sayHelloWorld());
                        }
                      catch(Exception e)
    {
    e.printStackTrace();
    }            }
            }
    把所有的文件保存在同一个目录下,然后
    1、javac *.java
    2、rmic  HelloWorldImpl
    3、java Server
    4、java Client
      

  2.   

    文子大哥,这个可以吗?好象你用的是JNDI,是吗?
      

  3.   

    文子大哥,照你的步骤,编译如下,问题一样。F:\x\x>dir2004-12-17  18:44       <DIR>          .
    2004-12-17  18:44       <DIR>          ..
    2004-12-17  18:39                  524 Server.java
    2004-12-17  18:39                  181 HelloWorld.java
    2004-12-17  18:39                  340 HelloWorldImpl.java
    2004-12-17  18:40                  490 Client.java
    2004-12-17  18:46                  703 Client.class
    2004-12-17  18:46                  224 HelloWorld.class
    2004-12-17  18:46                  403 HelloWorldImpl.class
    2004-12-17  18:46                  797 Server.class
    2004-12-17  18:49                    0 rmic
                   9 个文件          3,662 字节
                   2 个目录  9,804,546,048 可用字节F:\x\x>rmic  HelloWorldImpl
    error: Class HelloWorldImpl not found.
    1 error
      

  4.   

    你可以这么试一下;
    rmic -v1.2 -d . HelloWorldImpl
    还是不行的话,给他打个包(常规的做法)