Platforms to show: All Mac Windows Linux Cross-Platform

Back to JavaVMMBS class.

Previous items

JavaVMMBS.NewFloatArray(size as Integer) as JavaFloatArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for singles with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewFloatArray(values() as Single) as JavaFloatArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new float array with given values.

See also:

JavaVMMBS.NewIntArray(ref as JavaObjectMBS) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewIntArray(size as Integer) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for integers with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewIntArray(values() as Int32) as JavaIntArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new Int32 array with given values.

See also:

JavaVMMBS.NewLongArray(ref as JavaObjectMBS) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewLongArray(size as Integer) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for 64 bit integers with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewLongArray(values() as Int64) as JavaLongArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new Int64 array with given values.

See also:

JavaVMMBS.NewObjectArray(ref as JavaObjectMBS) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

Some examples using this method:

JavaVMMBS.NewObjectArray(size as Integer, TheClass as JavaClassMBS, InitialValue as JavaObjectMBS = nil) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Constructs a new array holding objects in class elementClass.

All elements are initially set to initialElement.
Returns nil on any error.

See also:

JavaVMMBS.NewObjectArray(values() as JavaObjectMBS) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new Java object array with given size.

See also:

JavaVMMBS.NewShortArray(ref as JavaObjectMBS) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array object based on the given java object.

This function is a convenience function to convert a java object array reference to a java array object in Xojo. It can crash if the java object used is not the array of the requested type.

See also:

JavaVMMBS.NewShortArray(size as Integer) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new array for shorts with the given size.

Returns nil on any error.

See also:

JavaVMMBS.NewShortArray(values() as Int16) as JavaShortArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new short array with given values.

See also:

JavaVMMBS.NewStringArray(size as integer, InitialValue as JavaStringMBS = nil) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new Java string array with given size.

See also:

JavaVMMBS.NewStringArray(values() as String) as JavaObjectArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates new string array with given values.

See also:

JavaVMMBS.NewStringUnicode(s as string) as JavaStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new string.

Preferres an Unicode encoded string.

JavaVMMBS.NewStringUTF8(s as string) as JavaStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new string.
Example

// init Java
dim options() as string
dim javaVm as new JavaVMMBS(JavaVMMBS.JNI_VERSION_1_4, options, true)

// Get system class
Dim system As JavaClassMBS = javaVm.FindClass("java/lang/System")

If system <> Nil Then

// query method
dim transfomerGetPropertyId as JavaMethodMBS = system.GetStaticMethod("getProperty", "(Ljava/lang/String;)Ljava/lang/String;")
If transfomerGetPropertyId <> Nil Then

// make parameters
Dim keyString As JavaStringMBS = javaVm.NewStringUTF8("os.version")
dim m as New MemoryBlock(8)
m.Int64Value(0)=keyString.Handle

// run it
dim r as JavaObjectMBS = system.CallStaticObjectMethod(transfomerGetPropertyId, m)

if r<>Nil then
// show result
dim s as JavaStringMBS = JavaStringMBS(r)
MsgBox s.CopyStringUTF
end if

End If
End If

Preferres an UTF8 encoded string.

Some examples using this method:

JavaVMMBS.Runtime as JavaRuntimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Returns the runtime object for the current VM so you can query the memory statistics.

Some examples using this method:

JavaVMMBS.ToReflectedField(TheClass as JavaClassMBS, fieldID as JavaFieldMBS, isStatic as boolean) as JavaObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new reflected field object for the given field.

JavaVMMBS.ToReflectedMethod(TheClass as JavaClassMBS, methodID as JavaMethodMBS, isStatic as boolean) as JavaObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new reflected method object for the given method.

JavaVMMBS.Version as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Returns the version of the java engine.

Currently the plugin always uses version 1.4.

Returns the major version number in the higher 16 bits and the minor version number in the lower 16 bits.

In JDK1.1, GetVersion() returns 0x00010001.

Previous items

The items on this page are in the following plugins: MBS Java Plugin.


💬 Ask a question or report a problem
The biggest plugin in space...