Platforms to show: All Mac Windows Linux Cross-Platform

JavaVMMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Java MBS Java Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The class for a java virtual machine.
Example
Var vm as JavaVMMBS // global

const JNI_VERSION_1_1 = &h00010001
const JNI_VERSION_1_2 = &h00010002
const JNI_VERSION_1_4 = &h00010004

if TargetLinux then
// change path for your linux PC!
JavaVMMBS.SetLibraryPath("/home/cs/jre1.6.0_05/lib/i386/client/libjvm.so")
end if

Var options(-1) as string
Var f as FolderItem=GetFolderItem("test.jar")

vm=new JavaVMMBS(JNI_VERSION_1_4, options, f, false)

if vm.Handle = 0 then
MsgBox "Can't create Java VM"
else
MsgBox "Java Initialized."
end if

Add Linux support plugin version 8.7.

Releasing the java vm (by releasing all java objects), and reinitializing can fail.

Please make sure this Java VM object stays alive until you are done with all your java stuff. So all the java objects go away and this vm object is destroyed on the end. Because if some java code is still running like an background java thread, quitting the VM can lead into crashes.

While the plugin supports to have several instances, it seems like JNI does not support that.

On Windows, we look into Local Machine\SOFTWARE\JavaSoft\Java Runtime Environment in registry to find the newest entry and the path to the jvm.dll file. Please note that on Windows you can install 32-bit and 64-bit version of Java and you need the matching bit number to FileMaker application.

If you get error 126 on Windows, maybe MSVCR100.DLL is missing. So install Visual Studio 2010 runtime libraries. You can download them from Microsoft website. Do not download them from other websites spreading malware!

Constants

Constant Value Description
JNI_VERSION_1_1 &h00010001 One of the constants to specify the JNI version in the constructor.
JNI_VERSION_1_2 &h00010002 One of the constants to specify the JNI version in the constructor.
JNI_VERSION_1_4 &h00010004 One of the constants to specify the JNI version in the constructor.
JNI_VERSION_1_6 &h00010006 One of the constants to specify the JNI version in the constructor.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

Release notes

  • Version 23.2
    • Fixed a problem which prevents JavaVMMBS to initialize on macOS and Linux with current JDK 19.
  • Version 21.3
    • Changed JavaVMMBS constructor to not to try to load JavaVM.framework, which results in a crash on Big Sur.
  • Version 20.3
    • Added DefineClass method to JavaVMMBS class.
  • Version 20.0
    • Updated JavaVMMBS constructor to better find Java libraries.
  • Version 19.4
    • Improved search for JavaVMMBS class to find jvm.dll on Windows.
  • Version 19.2
    • Added new methods to JavaVMMBS class to create Java arrays based on Xojo arrays.
  • Version 18.1
    • Improved JavaVMMBS.SetLibraryPath function to work for Mac, too.

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


JavaThrowableMBS   -   JPEG2000MBS


The biggest plugin in space...