Chiedo scusa per il titolo.Mi sembrava esplicativo.Comunque ho provato a studiare la documentazione della sun su rmi e tutto funziona.Il problema è che ho riprovato gli stessi passi con il codice del libro e non và.Utilizzando l'utility rmic non mi crea il file stub e skeleton perchè non trova la classe del client.Quindi quando vado a fare rmic com.prefect.pi.Pi che è il file server nel package com.prefect.pi mi dice che non trova il file server Pi.Ecco il codice di Pi:
codice:
import java.net.*;
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;

public class Pi extends UnicastRemoteObject implements PiRemoto {

   public double getPi() throws RemoteException {
        return Math.PI;
    }

    public Pi() throws RemoteException {
    }

    public static void main(String[] arguments) {
        System.setSecurityManager(new RMISecurityManager());
        try {
            Pi p = new Pi();
            Naming.bind("//Ventura-PC:1010/Pi", p);
        } catch (Exception e) {
            System.out.println("Error -- " +e.toString());
                e.printStackTrace();
        }
    }
}
L'errore che mi dà è questo:
codice:
Error -- java.rmi.ConnectException: Connection refused to host: Ventura-PC; nested exception is: 
java.rmi.ConnectException: Connection refused to host: Ventura-PC; nested exception is: 
	java.net.ConnectException: Connection refused: connect
	java.net.ConnectException: Connection refused: connect
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
	at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
	at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
	at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
	at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
	at java.rmi.Naming.bind(Naming.java:111)
	at com.prefect.pi.Pi.main(Pi.java:23)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at java.net.Socket.<init>(Socket.java:375)
	at java.net.Socket.<init>(Socket.java:189)
	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
	at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
	... 6 more
Questo errore me lo dà netbeans.Quando provo invece da riga di comando mi dice classe non trovata.