Java.CallStaticMethod
---------------------

Calls a static method on a class.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Java](component_Java.md) | [6.5](newinversion65.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |

MBS( "Java.CallStaticMethod"; ClassName; MethodName; Signature { ; Params... } ) 

**MBS**( **"Java.CallStaticMethod";** /\* Calls a static method on a class. \*/  
**$ClassName**; /\* The name of the java class.e.g. "com.mbs.test" \*/   
**$MethodName**; /\* The name of the method.e.g. "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.e.g. "\[\]" \*/   
**$Params...**) /\* Optional; The parameters to pass.  
Pass one parameter in FileMaker for each parameter to pass. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| 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... | The parameters to pass.   Pass one parameter in FileMaker for each parameter to pass. |  | Optional |

### 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](JavaRelease.md) to release an object if this function returns one.  
  
Java is only available if you call [Java.Initialize](JavaInitialize.md) 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](component_DynaPDF.md) functions initialized, this function can add previews for the PDF file on Windows and Linux. For MacOS, we make them with PDFKit.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Params parameter as often as you need.  
### 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

- [IsError](IsError.md)
- [Java.CallObjectMethod](JavaCallObjectMethod.md)
- [Java.Initialize](JavaInitialize.md)
- [Java.Release](JavaRelease.md)

### Example Databases

- [Java/Java Tests/Java Tests](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Java/Java%20Tests/Java%20Tests.shtml#2ScriptAnchor_)

This function checks for a license.

Created 2nd October 2016 , last changed 25th February 2026

  
[Java.CallObjectMethod](JavaCallObjectMethod.md) - [Java.DefineClass](JavaDefineClass.md)

[HTML Version](JavaCallStaticMethod.shtml)