Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   8.6    Statistic  

Java.CallStaticMethod

Calls a static method on a class.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Java 6.5 Yes Yes Yes Yes No
MBS( "Java.CallStaticMethod"; ClassName; MethodName; Signature { ; Params } )   More

Parameters

Parameter Description Example value
ClassName The name of the java class. "com.mbs.test"
MethodName The name of the method. "test"
Signature The java signature of the method.
This describes the parameter types.
Please use "javap -s test.class" with file path to class file to show the signatures for a class.
"[]"
Params Optional
The parameters to pass.
Pass one parameter in FileMaker for each parameter to pass.

Result

Returns result or error.

Description

Calls a static method on a class.
Parameters and return type is detected by plugin automatically from signature.
Please call later Java.Release to release an object if this function returns one.

Java is only available if you call Java.Initialize before to load the java runtime.
Supported data types include: void, int, long, boolean, string, double, float, char, byte, object, byte array (for container), char array (using FileMaker text).

For PDF content: If you have a DynaPDF Pro license and DynaPDF functions initialized, this function can add previews for the PDF file on Windows and Linux. For MacOS, we make them with PDFKit.

Examples

Call Function GetString:

MBS( "Java.CallStaticMethod"; "test"; "GetString"; "()Ljava/lang/String;" )

Call function returning an integer:

// public static int method_int(int a, double b, char c, long d, short e)
Set Variable [$r; Value:MBS( "Java.CallStaticMethod"; "tests"; "method_int"; "(IDCJS)I"; 10000; 2000; 300; 40; 5 )]
If [MBS("IsError") or ($r ≠ 12345)]
    Show Custom Dialog ["Java Error"; $r]
    Exit Script [Result: "Static int method failed"]
End If

Call function returning a double value:

// public static double method_double(int a, double b, char c, long d, short e)
Set Variable [$r; Value:MBS( "Java.CallStaticMethod"; "tests"; "method_double"; "(IDCJS)D"; 10000; 2000; 300; 40; 5 )]
If [MBS("IsError") or ($r ≠ 12345)]
    Show Custom Dialog ["Java Error"; $r]
    Exit Script [Result: "Static double method failed"]
End If

See also

Example Databases

Created 2nd October 2016, last changed 22nd November 2018


Java.CallObjectMethod   -   Java.GetContainerFileName

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins