1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
try {
java.rmi.registry.LocateRegistry.createRegistry(1099); // Lance le RMI
System.out.println("Mise en place du Security Manager ...");
if(System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager()) ;
} catch (Exception e) {
System.out.println("Exception capturée: " + e.getMessage());
}
MonInterface monObjet = (MonInterface) Naming.lookup("rmi://localhost:1099/monService"); // Tu utilises le nom du service créé par le serveur
monObjet.monAction();
//-------------
// Code serveur
//-------------
MonInterfaceImpl o = new MonInterfaceImpl();
Naming.rebind("monService", o); |
Partager