Invoke(ClassName: String, MethodName: String, MethodSig: String, Params: Array): Variant;
ClassName. Java class name in the file system or system module name in the JNI signature. When a Java class is specified, a file with the *.class extension is used in the file system. Parameter value is case sensitive.
MethodName. Name of executed method. Parameter value is case sensitive.
MethodSig. JNI signature of method.
Params. Array of parameter values sent to method.
The Invoke method executes static Java method and returns result of its work.
To execute the method, make sure that the file with the *.class extension is located at the path specified using the Options string parameter in the registry key HKEY_CURRENT_USER\SOFTWARE\Foresight\Foresight Analytics Platform\10.0\DevEnv\Java. For details see the Connecting External Modules to Foresight Analytics Platform section.
To get a Java class in the file system and convert the file with the *.java extension to the file with the *.class extension, use the IJavaUtils.Compile method.
Executing the example requires the Test.class file. The file should be located in the file system at the specified path in the registry and should contain the compiled version of the following Java code:
public class Test {
public static double staticFunc(double a, double b){
return (a + b)/2;
}
}
Add a link to the Java system assembly.
Sub UserProc;
Var
Result: Variant;
Begin
Result := Java.Invoke("Test", "staticFunc", "(DD)D", 3.0, 4.0);
Debug.WriteLine(Result);
End Sub UserProc;
On executing the example, a Java function will be executed, which executes mathematical calculation based on the values sent in parameters. The function execution result will be displayed in the development environment console.
See also: