CORBA 2.6.1 Programmer's Guide for Java

Chapter 12. Developing Prototype Applications on a PC
Chapter 12. Developing Prototype Applications on a PC
JORB Lite Applet Support
Initializing the ORB
Java Applet Configuration
Resolving the Initial Naming Service Reference
One major feature of the Java language is the ability to "write once, run anywhere." You can develop and test applications on a workstation
using JORB Lite without tying up NSK system resources. This capability means that you can generate JORB Lite clients and servers and move
their generated
.class bytecode files to the NonStop Kernel for execution in a NonStop CORBA environment. You can also move the client or
server
.class files and allow JORB Lite applications to interoperate with NonStop CORBA applications. Note that the Java Swing and AWT
packages are not supported on NonStop systems.
To use JORB Lite as a development and test environment, follow these general steps (an example follows later in this section):
Design and code your application as you normally would.
Execute the JORB Lite env.bat file to point to the location of the Java Virtual Machine (JVM) on your workstation. Ensure that the PATH
environment setting includes the JVM and that the
CLASSPATH includes the location of the Java JVM classes, jorblite.jar, and
nsdidl.jar files on your workstation. The default location is c:\jorblite\etc\env.bat.
Create and run a make.bat file to generate your Java files and build the client and server applications.
Set up any necessary client and server profile entities in the lite.dbm file. The default location is c:\jorblite\lib\lite.dbm.
Start a second Command Prompt window, and run the env.bat file.
Run your client and server programs.
Test and verify your application in the JORB Lite environment.
Once you have developed your application on your workstation, you can move the generated .class files (binary mode) using a file-transfer
program such as
FTP to a directory on Open System Services. Then:
Use the cfgmgt tool to configure the NonStop CORBA server application profile. See Application Profiles: Configuring and Managing an
Application for more information.
Start two OSS windows and run the $NSD_ROOT/etc/env.sh script on the NSK system.
Because the
.class bytecode files built using JORB Lite now reside on the NonStop Kernel under Open System Services, you can run your
program on either the PC or on the NSK system. You will get the same execution results.
The example that follows later in this section shows that you can develop NonStop CORBA applications using JORB Lite, move the compiled
.class bytecode files to the OSS environment, and run the applications using NonStop CORBA.
Caution:
The JORB Lite environment is provided for application development. The JORB Lite environment is not to be
used for production.
To see an example of building and running an application in the PC environment, see the Stock sample program, available at
C:\jorblite\javasamples\stock. This sample also demonstrates portability of a Java CORBA application between JORB Lite and NonStop
CORBA.
JORB Lite Applet Support
JORB Lite supports both Java applications and Java applets. However, because of the constraints placed on Java applets by both the Java and
OMG specifications, applets are treated differently from Java applications. This topic discusses some of these differences and how they relate to
the CORBA applet programs you create using JORB Lite.
Initializing the ORB
Java applets and Java applications make different calls to initialize the ORB:
org.omg.CORBA.ORB.init()
The difference can be seen in the following sample code fragments. A Java application initializes the ORB by using the following signature of the
init() call:
public static ORB init(String[] args, Properties props)