External Development Guide: Using Java Objects in IDL |
The IDL-Java bridge must be configured before trying to create and use Java objects within IDL. The IDL program initializes the bridge when it first attempts to create an instance of IDLjavaObject. Initializing the bridge involves starting the Java Virtual Machine, creating any internal Java bridge objects (both C++ and Java) including the internal IDLJavaBridgeSession object. See The IDLJavaBridgeSession Object for more information on the session object.
The .idljavabrc
file on UNIX or idljavabrc
on Windows contains the IDL-Java bridge configuration information. Even though the IDL installer attempts to create a valid working configuration file based on IDL location, the file should be verified before trying to create and use Java objects within IDL.
The IDL-Java bridge looks for the configuration file in the following order:
Note This environment variable must include both the path and the file name of the configuration file. |
/external/objbridge/java
path is used to try to locate the configuration file.The configuration file contains the following settings. With a text editor, open your configuration file to verify these settings are correct for your system.
JVM Classpath
setting specifies additional locations for user classes. It must point to the location of any class files to be used by the bridge. On Windows, paths should be separated by semi-colons. On UNIX, colons should separate paths.
This path may contain folders that contain class files or specific jar files. It follows the same rules for specifying '-classpath' when running java
or javac
. You can also include the CLASSPATH environment variable in the JVM Classpath
:
JVM Classpath = $CLASSPATH:/home/johnd/myClasses.jar
which allows any class defined in the CLASSPATH environment variable to be used in the IDL-Java bridge.
On Windows, an example of a typical JVM Classpath
setting is:
JVM Classpath = E:\myClasses.jar;$CLASSPATH
On UNIX, an example of a typical JVM Classpath
setting is:
JVM Classpath = /home/johnd/myClasses.jar:$CLASSPATH
JVM LibLocation
setting tells the Windows IDL-Java bridge which JVM shared library within a given Java version to use. Various versions of Java ship with different types of JVM libraries. For example, Java 1.3 on Windows ships with a "classic" JVM, a "hotspot" JVM, and a "server" JVM. Other versions and platforms have different JVM types.
On Windows, an example of a typical JVM LibLocation
setting is:
JVM LibLocation = E:\jdk1.3.1_02\jre\bin\hotspot
On UNIX, you should not set JVM LibLocation
in the configuration file. Instead, set the IDLJAVAB_LIB_LOCATION environment variable for the session that will use the IDL-Java bridge. The following is a typical command to set the environment variable:
SETENV IDLJAVAB_LIB_LOCATION /usr/java/j2re1.4.0_02/lib/sparc/client
Note You can also set the IDLJAVAB_LIB_LOCATION environment variable on Windows platforms, rather than specifying the value in the configuration file. |
Note On Macintosh platforms, IDL is hard-coded to use the Java VM 1.3.1, and so the system ignores any value you place in IDLJAVAB_LIB_LOCATION. |
JVM Option
# (where # is any whole number) setting allows you to send additional parameters to the Java Virtual machine upon initialization. These settings must be specified as string values. When these settings are encountered in the initialization, the options are added to the end of the options that the bridge sets by default.
Log Location
setting indicates the directory where IDL-Java bridge log files will be created. The default location provided by the IDL installer is /tmp
on Unix and c:\temp
on Windows.
Bridge Logging
setting indicates the type of bridge debug logging to be sent to a file called jb_log
<pid>.txt
(where <pid> is a process ID number) located in the directory specified by the Log Location
setting.
Acceptable values (from least verbose to most verbose) are SEVERE
, CONFIG
, CONFIGFINE
. The default value is SEVERE
, which specifies that bridge errors are logged. The CONFIG
value indicates the configuration settings are also logged. The CONFIGFINE
value is the same as CONFIG
, but provides more detail.
No log file is created if this setting is set to OFF
.
The IDL-Java bridge usually only uses the configuration file once during an IDL session. The file is used when the first instance of the IDLjavaObject class is created in the session. If you edit the configuration file after the first instance is created, you must exit and restart IDL to update the IDL-Java bridge with the changes you made to the file.
IDL Online Help (June 16, 2005)