Java核心代码例程之:RMIClient.java
2008-01-05 08:38:18 来源:WEB开发网核心提示:import java.rmi.*;/** * This class is the client for RMIExampleServer * @author Renga **/public class RMIClient {/** * Main method * @param args Command-line ar
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();
}
}
}
更多精彩
赞助商链接