public static void main(String[] args){
        
        // The following code can throw a RemoteException.
        try { 
            
            // Set Security Manager.
            // For RMI to download classes, a security manager must be in force.
            
            /*  This will cause errors if you don't have the right policies. disabled.
            if (System.getSecurityManager() == null) {
                System.setSecurityManager(new SecurityManager());
            }            
            */
                    
            // Create the registry. Default port: 1099.
            // By binding it like this you don't need to use your command line.
            Registry registry = LocateRegistry.createRegistry(DEFAULT_PORT);

            // Instantiate the implementation class.
            WriterImpl w = new WriterImpl();
            
            // bind it to the registry.
            registry.bind("write", w);
            
        // Catches exception by printing error.
        } catch (Exception e) { 
            System.out.println(e.getMessage());
        }        
    }