Java virtual machine initialization tips
Initialize the Java virtual machine (JVM) code with the ActiveX to Enterprise Java Beans (EJB) bridge. For an ActiveX client program (Visual Basic, VBScript, or ASP) to access Java classes or objects, the first step that the program must do is to create Java virtual machine (JVM) code within its process. To create JVM code, the ActiveX program calls the XJBInit() method of the XJB.JClassFactory object. When an XJB.JClassFactory object is created and the XJBInit() method called, the JVM is initialized and ready to use.
To enable the XJB.JClassFactory to find the Java run-time description definition language (DLL) when initializing, the Java Runtime Environment (JRE) bin and bin\classic directories must exist in the system path environment variable.
The XJBInit() method accepts only one parameter: an array of strings. Each string in the array represents a command line argument that for a Java program you would normally specify on the Java.exe command line. This string interface is used to set the class path, stack size, heap size and debug settings. We can get a listing of these parameters by typing java -? from the command line.
If you set a parameter incorrectly, you receive a 0x6002 "Failed to initialize VM" error message.
Due to the current limitations of Java Native Interface (JNI), you cannot unload or reinitialize the JVM code after it has loaded. Therefore, after the XJBInit() method has been called once, subsequent calls have no effect other than to create a duplicate JClassFactory object for you to access. It is best to store your XJB.JClassFactory object globally and continue to reuse that object.
The following Visual Basic extract shows an example of initializing JVM code
Dim oXJB as Object set oXJB = CreateObject("XJB.JClassFactory") Dim astrJavaInitProps(0) as String astrJavaInitProps(0) = _ "-Djava.class.path=.;c:\myjavaclasses;c:\myjars\myjar.jar" oXJB.XJBInit(astrJavaInitProps)