Knowledge Base

Notice Information in this article applies to Excelsior JET version 3.6 and above.

APPLICABILITY

This article only applies to the Windows version of Excelsior JET. The procedures described in it were tested against Intrinsyc J-Integra for COM 2.4 and may not work for other versions.

SUMMARY

This document contains step-by-step instructions for using Excelsior JET to create a COM-accessible DLL/EXE from your Java code with the help of Intrinsyc’s J-Integra for COM.

INTRODUCTION

Java code may be integrated with code written in other languages via Java Native Interface (JNI). JNI is the standard mechanism designed by Sun to integrate Java with other languages. Unfortunately, using bare JNI for communication between Java and COM is quite complicated. There are several Java-to-COM bridges on the market which simplify such an integration. One of them is J-Integra for COM by Intrinsyc.

This document describes how to use Excelsior JET and J-Integra for COM together to convert your Java components to COM-accessible Windows executables (EXE or DLL).

DETAILS

If you are not a J-Integra for COM user, download a free evaluation version from:
http://j-integra.intrinsyc.com/downloads/.

For more information about J-Integra for COM, refer to its online documentation: http://j-integra.intrinsyc.com/support/com/doc/.

Create a COM-accessible Java component

First of all, you have to create a COM-accessible Java component using J-Integra for COM and make sure that it works properly on the Sun HotSpot JVM. Please refer to J-Integra documentation for instructions.

The discussion below is based on the "J-Integra Visual C++ to Java" example described at http://j-integra.intrinsyc.com/support/com/doc/javafromcom/vc2java.html. It assumes that Java class files for this example are placed in D:\pure\vceb directory, and J-Integra for COM is installed in E:\jintegra.

Compile the component with Excelsior JET

On this step, you will use Excelsior JET to compile your Java code and the proxy classes produced by J-Integra’s java2com utility together into an out-of-process COM server (EXE file).

  1. Launch the JET Control Panel and create a new project. /In Excelsior JET 4.0 and below select “Manual setting” on the New page./
  2. Add these items to the classpath:
    • Directory D:\pure\vceb
    • Jar file J-Integra-home\lib\jintegra.jar
  3. Specify Main as the main class.
  4. Go to the Options page. On the Advanced tab select the "Dynamic compilation" option from the "Class absence results in" combobox. Note: In Excelsior JET version 3.7 and below, go to the Options page and select the "Run-time error" option.
  5. Go to the Target page. Specify the project directory and target executable file name.
  6. Go to the Compile page, click Build:

    and wait until compilation completes. The Main.exe file will be created in the target directory.

Invoke the JET-compiled component via COM

J-Integra-based COM server can be accessed from COM clients using three different mechanisms. This section describes how to invoke JET-compiled code using each of them. For more information, see:
http://j-integra.intrinsyc.com/com/doc/tools/regjvm.html.

DCOM mode

Register JVM:

    regjvmcmd vcebjvm localhost[1111]

Create a script called e.g. run.bat:

    set JETVMPROP=-DJINTEGRA_DCOM_PORT:1111
    Main.exe

and start it. Run the client executable (vcObserver.exe) and test the server.

Note: You can hard-wire system property values into the executable file produced by JET to get rid of the run.bat script. You specify hard-wired properties on the Target page of the JET Control Panel. For details, see Excelsior JET User’s Guide, Chapter “Application considerations”, section “System properties”.

Native mode

Register JVM:

    regjvmcmd /native vcebjvm

Create a script called e.g. run.bat:

    set JETVMPROP=-DJINTEGRA_NATIVE_MODE
    Main.exe

and start it. Run the client executable (vcObserver.exe) and test the server.

Note: You can hard-wire system property values into the executable file produced by JET to get rid of the run.bat script. You specify hard-wired properties on the Target page of the JET Control Panel. For details, see Excelsior JET User’s Guide, Chapter “Application considerations”, section “System properties”.

REFERENCES

  1. J-Integra for COM manuals:
    http://j-integra.intrinsyc.com/com/doc/
  2. J-Integra for COM download:
    http://j-integra.intrinsyc.com/j-integra/download/

Article ID: 21
Last Revised On: 26-Dec-2005