Java IDL: The "Hello World" Example on 2 machines

To enable the Hello World Tutorial to run on two machines, follow the steps as directed in the tutorial, with the following changes. This tutorial was written for the Java (tm) 2 Platform, Standard Edition (J2Se(tm)), version 1.3. In this example, the client, stubs, and skeletons are located on the client machine, and the server and name server are located on the server machine. This scenario can be changed to meet your needs and is provided simply as an introduction to one way this can be accomplished.

  1. Create and compile the Hello.idl file on the client machine as indicated in the tutorial:

       
       idlj -fall Hello.idl
    

  2. Create HelloClient.java on the client machine. Compile the .java files, including the stubs and skeletons (which are in the directory HelloApp):
       javac *.java HelloApp/*.java
    

  3. Create HelloServer.java on the server machine. Compile the .java files:
       javac *.java
    

  4. Start the Java IDL name server on the server machine. To do this on Unix:
       tnameserv -ORBInitialPort 1050&
    

    To do this on Windows:

       start tnameserv -ORBInitialPort 1050
    

    Note that the name server will run on port 1050 if you enter the command as listed. If you want a different nameserverport, replace 1050 with the correct port number.

  5. On the server machine, start the Hello server, as follows:
       java HelloServer  -ORBInitialPort 1050
    

    If you used a different nameserverport, replace 1050 with the correct port number.

  6. On the client machine, run the Hello application client. From a DOS prompt or shell, type:

       java HelloClient  -ORBInitialHost namerserverhost -ORBInitialPort 1050
    

    Note that nameserverhost is the host on which the IDL name server is running. In this case, it is the server machine.

    If you used a different nameserverport, replace 1050 with the correct port number.

  7. Kill or stop the server process when finished.