To use Java proxy objects with the ActiveX to Enterprise JavaBeans (EJB) bridge:
After an ActiveX client program (Visual Basic, VBScript, or Active Server Pages (ASP)) has initialized the XJB.JClassFactory object and thereby, the Java virtual machine (JVM), the client program can access Java classes and initialize Java objects. To complete this action, the client program uses the XJB.JClassFactory FindClass() and NewInstance() methods.
In Java programming, two ways exists to access Java classes: direct invocation through the Java compiler and through the Java Reflection interface. Because the ActiveX to Java bridge needs no compilation and is a complete run-time interface to the Java code, the bridge depends on the latter Reflection interface to access its classes, objects, methods and fields. The XJB.JClassFactory FindClass() and NewInstance() methods behave very similarly to the Java Class.forName() and the Method.invoke() and Field.invoke() methods.
... Dim clsMyString as Object Set clsMyString = oXJB.FindClass("java.lang.Integer")
... Dim strHexValue as String strHexValue = clsMyString.toHexString(CLng(255))
The equivalent Java syntax is: static String toHexString(int i). Because ints units in Java programming are really 32-bit (which translates to Long in Visual Basic), the CLng() function converts the value from the default int to a long. Also, even though the toHexString() function returns a java.lang.String, the code extract does not return an Object proxy. Instead, the returned java.lang.String is automatically converted to a native Visual Basic string.
... Dim oMyInteger as Object set oMyInteger = oXJB.NewInstance(CLng(255)) Dim strMyInteger as String strMyInteger = oMyInteger.toString