Spec-Zone .ru
спецификации, руководства, описания, API
|
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.4. 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 to distribute an application across two machines.
idlj -fall Hello.idl
javac *.java HelloApp/*.java
javac *.java
orbd -ORBInitialPort 1050 -ORBInitialHost servermachinename&
To do this on Windows:
start orbd -ORBInitialPort 1050 -ORBInitialHost servermachinename
Both -ORBInitialPort and -ORBInitialHost are required arguments on the orbd command line. This example starts the name server on port 1050, because on Solaris you must become root to start a process on a port under 1024. If you want to use a different nameserverport, replace 1050 with the correct port number throughout this example.
When using orbd, the ORBD must be run on the same machine as the machine on which the servers will be activated. Another Naming Service, tnameserv, could be used if you prefer to run the Naming Service on a machine other than the machine on which the servers will be activated.
java HelloServer -ORBInitialPort 1050
If you used a different nameserverport, replace 1050 with the correct port number. You do not need to specify the -ORBInitialHost argument because the Hello server will be running on the same host as the name server in this example. If the Name Server were running on a different machine, you would specify which machine using the -ORBInitialHost nameserverhost argument.
java HelloClient -ORBInitialHost nameserverhost -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.
Java Technology |
Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved. |