helloclient.java

来自「演示了如何在java平台使用corba」· Java 代码 · 共 37 行

JAVA
37
字号
//import HelloApp.*;import org.omg.CosNaming.*;import org.omg.CORBA.*;public class HelloClient {    public static void main(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);            // test
            System.out.println("OK..");                            // 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 oldhello = helloRef.lastMessage();
           //System.out.println(oldhello);	    String Hello = helloRef.sayHello();	    System.out.println(Hello);	} catch (Exception e) {	    System.out.println("ERROR : " + e) ;	    e.printStackTrace(System.out);	}    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?