首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:RMIClient.java

2019-11-18 15:16:52
字体:
来源:转载
供稿:网友

import java.rmi.*;

/**
 * This class is the client for RMIExampleServer
 * @author Renga
 **/
public class RMIClient {

/**
 * Main method
 * @param args Command-line arguments
 **/
public static void main( String[] args ) {
try {
// Set the security manager
System.setSecurityManager( new RMISecurityManager() );

// Look up RMIExampleServer in the RMI registry
RMIExample server = (RMIExample) Naming.lookup( "RMIExample" );

// Invoke the method
System.out.PRintln( server.sayHello() );
} catch( Exception e ) {
e.printStackTrace();
}
}
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表