helloworldclient.java

来自「用JAVA编写的HelloWorld中间件程序,对新人的研究学习有很大的帮助.本」· Java 代码 · 共 22 行

JAVA
22
字号
import sample.*; 
import org.omg.CosNaming.*; 
import org.omg.CORBA.*; 

public class HelloWorldClient { 
public static void main(String args[]) { 
try{
ORB orb = ORB.init(args, null);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); 
NamingContext ncRef = NamingContextHelper.narrow(objRef); 
NameComponent nc = new NameComponent("HelloWorld",""); 
NameComponent path[] = {nc}; 
HelloWorld helloWorld = HelloWorldHelper.narrow(ncRef.resolve(path)); 
String hello = helloWorld.sayHello(); 
System.out.println(hello); 
} catch (Exception e) {
System.out.println("ERROR : " + e) ;
e.printStackTrace(System.out); 
} 
} 
}

⌨️ 快捷键说明

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