Developing a Java/RMI Client using JRMP
Gopalan Suresh Raj

Note
To work with any of these samples, you will need the following:
.........................................JDK 1.2 (Java 2) or higher

The Steps involved in developing a Java/RMI Client are

1. Develop your Java/RMI Client
2. Develop your policy file
3. Compile the files and run the client

1. Develop your Java/RMI Client

StockMarketClient.java
/**
 * StockMarketClient
 */

import java.rmi.*;
import java.rmi.registry.*;

import SimpleStocks.*;

public class StockMarketClient {
 
  public static void main(String[] args) {
    try {
      if(System.getSecurityManager() == null) {
        System.setSecurityManager( new RMISecurityManager() );

      }
      StockMarket market = (StockMarket)Naming.lookup("rmi://localhost/NASDAQ");
      System.out.println( "The price of MY COMPANY is "
                          + market.get_price("MY_COMPANY") );
    }
    catch( Exception e ) {
      System.out.println( e );
    }
  }

}
 

2. Develop your security policy file

policy.all
grant {
 permission java.security.AllPermission "", "";
};

3. Compile the files and run the client


E:\MyProjects\StockRMI>
E:\MyProjects\StockRMI>javac *.java

E:\MyProjects\StockRMI>java -Djava.security.policy=policy.all StockMarketClient
The price of MY COMPANY is 159.2

E:\MyProjects\StockRMI>

 

Java/RMI
Java/RMI - Under The Hood
Developing a Java/RMI Server using JRMP
Developing a Java/RMI Client using JRMP
Developing a Java/RMI Server Component using IIOP
Developing a Java/RMI Client to our RMI/IIOP Server Component
Developing a CORBA Client to our RMI/IIOP Server Component

 


Go to the Component Engineering Cornucopia page

This site was developed and is maintained by Gopalan Suresh Raj

This page has been visited times since September 21,1998.

Last Updated : Dec 19, '98

If you have any questions, comments, or problems regarding this site, please write to me I would love to hear from you.


Copyright (c) 1997-99, Gopalan Suresh Raj - All rights reserved. Terms of use.

All products and companies mentioned at this site,are trademarks of their respective owners.