Java.CallObjectMethod
---------------------

Calls a method on an object.

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

MBS( "Java.CallObjectMethod"; JObject; MethodName; Signature { ; Params... } ) 

**MBS**( **"Java.CallObjectMethod";** /\* Calls a method on an object. \*/  
**$JObject**; /\* The java object reference number.e.g. $j \*/   
**$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 |
|---|---|---|---|
| JObject | The java object reference number. | $j |  |
| 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 value or error.

### Description

Calls a method on an object.  
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

Init a class and a call a merthod:

 Set Variable \[$j ; Value:MBS ( "[Java.NewClassObject](JavaNewClassObject.md)"; "test"; "&lt;init&gt;"; "()V")\]  
Set Variable \[$r ; Value:MBS ( "Java.CallObjectMethod"; $j ; "getValue"; "()I" )\]  
Show Custom Dialog \["value"; $r \]  
Set Variable \[$r ; Value:MBS ( "[Java.Release](JavaRelease.md)"; $j )\]  
Call method passing parameter and another to query:

 Set Variable \[$j ; Value:MBS ( "[Java.NewClassObject](JavaNewClassObject.md)"; "test"; "&lt;init&gt;"; "()V")\]  
Set Variable \[$r ; Value:MBS ( "Java.CallObjectMethod"; $j ; "setValue"; "(I)V"; 1234 )\]  
Set Variable \[$r ; Value:MBS ( "Java.CallObjectMethod"; $j ; "getValue"; "()I")\]  
Show Custom Dialog \["value"; $r \]  
Set Variable \[$r ; Value:MBS ( "[Java.Release](JavaRelease.md)"; $j )\]  
Call a void method

 # public void DoSomething()   
Set Variable \[$r ; Value:MBS ( "Java.CallObjectMethod"; $j ; "DoSomething"; "()V" )\]  
### See also

- [Java.CallStaticMethod](JavaCallStaticMethod.md)
- [Java.Initialize](JavaInitialize.md)
- [Java.NewClassObject](JavaNewClassObject.md)
- [Java.Release](JavaRelease.md)

### Example Databases

- [Java/Java Example/Java Example](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Java/Java%20Example/Java%20Example.shtml#2ScriptAnchor_)
- [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

  
[JSON.UpdateRecords](JSONUpdateRecords.md) - [Java.CallStaticMethod](JavaCallStaticMethod.md)

[HTML Version](JavaCallObjectMethod.shtml)