Java.GetStaticField
-------------------

Queries a static field 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.GetStaticField"; ClassName; FieldName; Signature ) 

**MBS**( **"Java.GetStaticField";** /\* Queries a static field on a class. \*/  
**$ClassName**; /\* The name of the java class.e.g. "com.mbs.test" \*/   
**$FieldName**; /\* The name of the field.e.g. "test" \*/   
**$Signature**) /\* The java signature of the field.  
This describes the data type of the field.e.g. "I" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ClassName | The name of the java class. | "com.mbs.test" |
| FieldName | The name of the field. | "test" |
| Signature | The java signature of the field.   This describes the data type of the field. | "I" |

### Result

Returns value or error.

### Description

Queries a static field on a class.  
This is like a global variable as there is only one value for all objects of the class.  
Data type is automatically detected by plugin from signature.  
If you read an object value, please call [Java.Release](JavaRelease.md) later for it.  
  
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.  
### Examples

Test static field:

 Set Variable \[$r ; Value:MBS ( "[Java.SetStaticField](JavaSetStaticField.md)"; "test"; "n"; "I"; 3456)\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "test"; "n"; "I")\]  
Show Custom Dialog \["value"; $r \]  
Query various static fields:

 Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_boolean"; "Z")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_byte"; "B")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_byteArray"; "\[B")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_char"; "C")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_charArray"; "\[C")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_double"; "D")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_float"; "F")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_int"; "I")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_long"; "J")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_short"; "S")\]  
Set Variable \[$r ; Value:MBS ( "Java.GetStaticField"; "tests"; "static\_property\_string"; "Ljava/lang/String;")\]  
### See also

- [Java.Initialize](JavaInitialize.md)
- [Java.Release](JavaRelease.md)
- [Java.SetStaticField](JavaSetStaticField.md)

### Example Databases

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

  
[Java.GetObjectField](JavaGetObjectField.md) - [Java.GetTag](JavaGetTag.md)

[HTML Version](JavaGetStaticField.shtml)