Java.NewClassObject
-------------------

Creates a new object and invokes constructor.

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

MBS( "Java.NewClassObject"; ClassName; ConstructorName; Signature { ; Params... } ) 

**MBS**( **"Java.NewClassObject";** /\* Creates a new object and invokes constructor. \*/  
**$ClassName**; /\* The name of the java class.e.g. "com.mbs.test" \*/   
**$ConstructorName**; /\* The name of the constructor.e.g. "test" \*/   
**$Signature**; /\* The java signature of the method.  
This describes the parameter types.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" |  |
| ConstructorName | The name of the constructor. | "test" |  |
| Signature | The java signature of the method.   This describes the parameter types. | "()" |  |
| Params... | The parameters to pass.   Pass one parameter in FileMaker for each parameter to pass. |  | Optional |

### Result

Returns object reference or error.

### Description

Creates a new object and invokes constructor.  
Parameters and return type is detected by plugin automatically from signature.  
Please call later [Java.Release](JavaRelease.md) to release the object.  
  
Java is only available if you call [Java.Initialize](JavaInitialize.md) before to load the java runtime.  
  
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

Create a new test object with default constructor:

 MBS ( "Java.NewClassObject"; "test"; "&lt;init&gt;"; "()V")  
### See also

- [Java.CallObjectMethod](JavaCallObjectMethod.md)
- [Java.GetObjectField](JavaGetObjectField.md)
- [Java.Initialize](JavaInitialize.md)
- [Java.ObjectClassName](JavaObjectClassName.md)
- [Java.Release](JavaRelease.md)
- [Java.SetObjectField](JavaSetObjectField.md)

### Release notes

- **Version 9.3**
    - Fixed problem in parameter parsing for [Java.NewClassObject](http://www.mbsplugins.eu/JavaNewClassObject.shtml) function.

### 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_)

### Blog Entries

- [MBS FileMaker Plugin, version 9.3pr3](https://www.mbsplugins.de/archive/2019-06-21/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 2nd October 2016 , last changed 5th June 2021

  
[Java.List](JavaList.md) - [Java.ObjectClassName](JavaObjectClassName.md)

[HTML Version](JavaNewClassObject.shtml)