Advertisement
soonh123

Untitled

Oct 31st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package dk.sdu.mmmi.opn.assignment2;
  2.  
  3.  
  4. import java.rmi.registry.LocateRegistry;
  5. import java.rmi.registry.Registry;
  6.  
  7. public class Server {
  8.  
  9. //the name assigned to the server object.
  10. public static final String NAME = "OPN-server(RMI)";
  11.  
  12. //the part on which the registry is run
  13. public static final int PORT = 5555;
  14.  
  15. public static void main(String[] args) {
  16. System.out.println("Launching server");
  17. try{
  18. CatalogueImpl cataImpl = new CatalogueImpl();
  19. Registry registry = LocateRegistry.createRegistry(Server.PORT);
  20. registry.rebind(Server.NAME, cataImpl);
  21. System.out.println("Server running (RMI)");
  22. } catch (Exception e){
  23. System.err.println("Server exception");
  24. e.printStackTrace();
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement