helloclient.java

来自「JavaJNDI examples of J[2]EE」· Java 代码 · 共 33 行

JAVA
33
字号
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);             // 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);	}    }}

⌨️ 快捷键说明

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