How to Run COM Clients in Native Mode (JVM Out-of-process)

Prior to reading this section, please read through (and ideally run) the standard DCOM COM-Java examples (VB to Java early and late binding, and VC++ to Java).

If you want your JVM to run out of process (but allow COM client access to the Java objects contained therein using native code), you must use the 'regjvm' command to register it as being native. The regjvm command sets up various registry entries to facilitate J-Integra®'s COM-Java mechanism:
 

In your main you then tell the J-Integra® runtime that the JVM is ready to receive calls by calling com.linar.jintegra.Jvm.register("MyJvm").

You would then start your JVM:
java -DJINTEGRA_NATIVE_MODE YourMain

From VB you can now use late binding to instantiate instances of any Java class that can be loaded in that JVM:
Set aHashtable = GetObject("MyJvm:java.util.Hashtable")

"MyJvm" is just a string to identify the JVM -- you can use anything.

This would only work if the JVM were already running. Additional parameters to the regjvm command can specify a command to be used to launch the JVM if it is not already running. Use 'regjvm/?' for more information.

Having registered the JVM, use the standard J-Integra® 'regtlb' command to allow early bound access to Java objects (regtlb takes as parameters the name of a type library, and a JVM name, and registers all the COM objects defined in that type library as being located in that JVM).

You can also control the instantiation of Java objects on behalf of COM clients by associating your own Instanciator with a JVM (additional parameter to com.linar.jintegra.Jvm.register(...)) -- a kind of object factory. This is used in most of the standard COM-EJB examples in the J-Integra® documentation.