can't run a rmi test program
===

here are the two classes and i want to compile and run but with errors, anyone knows what's the problem?

    java.rmi.ConnectException: Connection refused to host: 10.0.0.2; nested exception is: 
    	java.net.ConnectException: Connection refused: connect
    	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    	at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    	at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    	at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
    	at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    	at RegisterWithRMIServer.main(RegisterWithRMIServer.java:9)
    Caused by: java.net.ConnectException: Connection refused: connect
    	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
    	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
    	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    	at java.net.Socket.connect(Socket.java:579)
    	at java.net.Socket.connect(Socket.java:528)
    	at java.net.Socket.<init>(Socket.java:425)
    	at java.net.Socket.<init>(Socket.java:208)
    	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
    	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    	... 5 more




    import java.rmi.registry.*; 
       
    public class RegisterWithRMIServer { 
        /** Main method */ 
        public static void main(String[] args) { 
          try { 
            StudentServerInterface obj =  new StudentServerInterfaceImpl(); 
            Registry registry = LocateRegistry.getRegistry(); 
            registry.rebind("StudentServerInterfaceImpl", obj); 
            System.out.println("Student server " + obj +  " registered"); 
         } 
         catch (Exception ex) { 
           ex.printStackTrace(); 
         } 
       } 
     }

///////

    import java.rmi.*; 
    import java.rmi.server.*; 
    import java.util.*; 
      
    public class StudentServerInterfaceImpl  extends UnicastRemoteObject  
          implements StudentServerInterface { 
        // Stores scores in a map indexed by name 
            private HashMap<String, Double> scores =  
             new HashMap<String, Double>(); 
      
       public StudentServerInterfaceImpl() throws RemoteException { 
         initializeStudent(); 
       } 
      
       /** Initialize student information */ 
       protected void initializeStudent() { 
         scores.put("John", new Double(90.5)); 
         scores.put("Michael", new Double(100)); 
         scores.put("Michelle", new Double(98.5)); 
       } 
      
       /** Implement the findScore method from the  
        *  Student interface */ 
       public double findScore(String name) throws RemoteException { 
         Double d = (Double)scores.get(name); 
      
         if (d == null) { 
           System.out.println("Student " + name + " is not found "); 
           return -1; 
         } 
         else { 
         System.out.println("Student " + name + "\'s score is " + d.doubleValue()); 
           return d.doubleValue(); 
         } 
       } 
    }