FileDocCategorySizeDatePackage
HelloClient.javaAPI DocExample2471Wed Apr 19 11:18:38 BST 2000None

HelloClient

public class HelloClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

	try{
	    // create and initialize the ORB
	    ORB orb = ORB.init(args, null);

            // get the root naming context
            org.omg.CORBA.Object objRef = 
		orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);
 
            // resolve the Object Reference in Naming
            NameComponent nc = new NameComponent("Hello", "");
            NameComponent path[] = {nc};
            Hello helloRef = HelloHelper.narrow(ncRef.resolve(path));

	    // call the Hello server object and print results
	    String Hello = helloRef.sayHello();
	    System.out.println(Hello);

	} catch (Exception e) {
	    System.out.println("ERROR : " + e) ;
	    e.printStackTrace(System.out);
	}