-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRMIServerComponent.java
More file actions
29 lines (27 loc) · 1.11 KB
/
RMIServerComponent.java
File metadata and controls
29 lines (27 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.net.MalformedURLException;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.logging.Level;
import java.util.logging.Logger;
public class RMIServerComponent {
public static void main(String[] args){
try {
new RMIServerComponent().run();
} catch (MalformedURLException ex) {
Logger.getLogger(RMIServerComponent.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void run() throws MalformedURLException{
try{
RMIImplementation RMIImplementation =new RMIImplementation();
Registry registry = LocateRegistry.createRegistry(6666);
Naming.rebind("rmi://localhost:6666/RMIImplementation",RMIImplementation);
System.out.println("Server is running...");
}catch(RemoteException ex){
Logger.getLogger(RMIServerComponent.class.getName()).log(Level.SEVERE,null, ex);
}catch(MalformedURLException ex){
Logger.getLogger(RMIServerComponent.class.getName()).log(Level.SEVERE,null, ex);
}
}
}