Previous

Building Hello World under the Windows Operating System

Using Windows 95 or Windows NT, the source code for the Hello World example is located in [Path_to_JDK]\docs\guide\idl\examples\Hello. The following instructions assume you can use port 1050 for the Java IDL name server. Substitute a different port if necessary. Substitute the completely-qualified path to your JDK installation for [Path_to_JDK]

Note: Steps 2 and 3 require you to have downloaded and installed the idltojava compiler.

  1. Change to the example directory:
    cd [Path_to_JDK]\docs\guide\idl\examples\hello
    
  2. Make certain that the idltojava compiler ([Path_to_JDK]\bin) and the Java binaries are included in your path environment variable.

  3. Translate the IDL file to Java with the idltojava compiler to create stubs and skeletons.
    Note: idltojava is hard-coded to use a default preprocessor. On Windows machines, it uses the MS Visual C++ preprocessor. You can change the preprocessor that idltojava uses by setting two environment variables: CPP and CPARGS. Set CPP to the full pathname of the preprocessor you want to use. Set CPARGS to the complete list of arguments to be passed to the preprocessor. You can also turn off the preprocessor by adding -fno-cpp to the idltojava command line. More information is available in the idltojava reference page that is downloaded with the idltojava compiler.
    idltojava Hello.idl
  4. Compile the Java files, including the stubs and skeletons:
    javac *.java HelloApp\*.java
  5. Start the Java IDL name server:
    tnameserv -ORBInitialPort 1050

    The server runs in the background; you see no more evidence of it until you run the client program.

  6. Start the Hello server:
    java HelloServer -ORBInitialPort 1050
    
  7. Run the Hello application client:
    java HelloClient -ORBInitialPort 1050

    The string prints to the command line:

    Hello world!!

The name server and the Hello World server, like many CORBA servers, run until you explicitly stop them. To avoid having many servers running, kill the server processes before proceeding to Section One.


Previous