This section shows you how to compile and run
the server and the client program
that together make up the "Hello World" application.
Compiling the Client Application
- Compile
HelloClient.java
:
javac HelloClient.java HelloApp\*.java
- Correct any errors in your file and recompile if necessary.
- You should see
HelloClient.class
in the
project directory.
Compiling the Server
- Compile
HelloServer.java
:
javac HelloServer.java HelloApp\*.java
- Correct any errors in your file and recompile if necessary.
- You should see
HelloServer.class
and
HelloServant.class
.
Running the Client-Server Application
- From an MS-DOS system prompt (Windows) or command shell (UNIX),
start the Java IDL name server:
tnameserv -ORBInitialPort nameserverport
Note that nameserverport
is the port on which you want the name server to run. If you do not specify this, port 900 will be chosen by default. Also note that using Solaris software, you must become root to start a process on a port under 1024. For this reason, we recommend that you use a port number greater than or equal to 1024.
- From a second prompt or shell,
start the Hello server:
java HelloServer -ORBInitialHost nameserverhost
-ORBInitialPort nameserverport
Note that nameserverhost
is the host on which the IDL name server is running. You can omit -ORBInitialHost nameserverhost
if the name server is running on the same host as the Hello server. You can leave out -ORBInitialPort nameserverport
if the name server is running on the default port.
- From a third prompt or shell,
run the Hello application client:
java HelloClient -ORBInitialHost nameserverhost
-ORBInitialPort nameserverport
Note that nameserverhost
is the host on which the IDL name server is running. You can omit -ORBInitialHost nameserverhost
if the name server is running on the same host as the Hello client. You can leave out -ORBInitialPort nameserverport
if the name server is running on the default port.
-
The client prints the string from the server to the command line:
Hello world!!
Remember to stop both the tnameserv
and the
HelloServer
processes
after the client application returns successfully.