String name = "Compute";
System.out.println("Locate and initialize the registry");
Registry registry = LocateRegistry.getRegistry();
System.out.println("Lookup name " + name + " in the registry");
Compute comp = (Compute) registry.lookup(name);
System.out.println("Creating a new Pi task to be executed by the server");
Pi task = new Pi(Integer.parseInt(args[1]));
System.out.println("Sending task to server");
BigDecimal pi = comp.executeTask(task);
System.out.println("Result returned from the server: " + pi);
} catch (Exception e) {
System.err.println("ComputePi exception:");
e.printStackTrace();
}