Introductory information about the tutorial (in this file) includes:
Note: The Hello World example is provided with
pre-built stub and skeleton files. However, to generate these files yourself
and take full advantage of this Tutorial, you will need to
download the idltojava compiler.
This tutorial teaches the basic tasks in building a
CORBA distributed
application using Java IDL. You will build the classic "Hello World"
program as a distributed
application, with both applet and application
clients.The Hello World program has a single operation
that returns a string to be printed. Its basic function is illustrated below:
Despite its simple design, the Hello World program lets you learn and
experiment with all the tasks required to develop almost any CORBA program
that uses static invocation.
Each lesson has a directory in the docs/guide/idl/tutorial
directory of your JDK
installation containing valid source files and
compiled class files needed for completing the lesson.
Although the lessons are designed to build upon one another, you can
do the lessons in any order you want by using the files provided.
The lessons in this tutorial are listed below.
You can run the Hello World application before you
work through the tutorial. Follow the instructions listed for your
operating system:
Hello World Program Overview
Operation of the Distributed Hello World Program
Tutorial Overview
Previewing Hello World
Building Hello World under the
Solaris Operating System
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. (Note that to use a port below 1024, you need root access on Unix machines and administrator privileges on Wintel machines.) 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.
cd [Path_to_JDK]/docs/guide/examples/hello
idltojava Hello.idl
javac *.java HelloApp/*.java
tnameserv -ORBInitialPort 1050 &
You will see something like the following:
Initial Naming Context: IOR:000000000000002849444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578743a312e3000000000010000000000000034000100000000000974687572626c6967000086760000001cafabcafe0000000233de2f5c00000000000000080000000000000000 TransientNameServer: setting port for initial object references to: 1050
The server runs in the background; you see no more evidence of it until you run the client program.
java HelloServer -ORBInitialPort 1050 &
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 Lesson One.
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.
cd [Path_to_JDK]\docs\guide\idl\examples\hello
idltojava Hello.idl
javac *.java HelloApp\*.java
tnameserv -ORBInitialPort 1050
The server runs in the background; you see no more evidence of it until you run the client program.
java HelloServer -ORBInitialPort 1050
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 Lesson One.
Although concepts are explained as they are introduced in the
tutorial, you will find a discussion in greater depth and useful background
information
in the Fundamentals
section. In addition, new terms are linked to
their definitions throughout the tutorial.
Also,
CORBA for Beginnners
from the Object Management Group provides another source of basic CORBA
information.
For More Information
Home
Copyright
© 1996-1998 Sun Microsystems, Inc.,
2550 Garcia Ave., Mtn. View, CA. 94043-1100 USA., All rights
reserved.