Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Java.Initialize
Initializes JavaVM.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Java | 6.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
LibPath | Path to java library (e.g. jvm.dll) If empty, the plugin uses the Java framework on Mac and looks into registry on Windows to find newest Java installation. e.g. on Windows: "C:\Program Files\Java\jre1.8.0_101\bin\server\jvm.dll" |
"" | Optional |
ClassPathList | The list of native paths to the jar files to load. Please pass here all jar files you want to use. |
"/Users/cs/Desktop/test.jar" | Optional |
Option | Pass a parameter for each additional option to pass to Java VM initialization. | Optional |
Result
Returns OK or error.
Description
Initializes JavaVM.You can either pass path to jvm library file or let the plugin look for it. To access classes, you need to pass paths to the jar and class files you want to use.
Returns error if already a JavaVM is initialized.
Please be aware that you can only have one VM running at a given time, so you can’t use Java in other plugin and our plugin together.
This should work fine for any Java version starting with 1.4 or newer. Tested with 1.7 and 1.8.
May not initialize probably if other plugin initialized Java before.
Returns "Using existing Java VM." in case an existing Java VM initialized by other plugin is used. In that case we can't pass your class paths or other options!
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!
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Examples
Initialize java:
Set Variable [ $r ; Value: MBS("Java.Initialize") ]
If [ MBS("Java.Initialized") ]
Show Custom Dialog [ "Java" ; "Java initialized." ]
Else
Show Custom Dialog [ "Java" ; "Java failed to initialize" & ¶ & $r ]
End If
Initialize on Linux:
Set Variable [ $r ; Value: MBS("Java.Initialize"; "/home/cs/jrel.6.0_05/lib/x64/client/libjvm.so"; "/java/test.jar¶/java/driver.jar") ]
Init with three class path entries:
MBS("Java.Initialize"; Java Test::Path to Java Library; Java Test::ClassPath1 & ¶ & Java Test::ClassPath2 & ¶ & Java Test::ClassPath3)
Initialize using Java engine for Web Direct on Linux:
MBS( "Java.Initialize"; "/opt/FileMaker/FileMaker Server/Web Publishing/java/lib/amd64/server/libjvm.so" )
See also
- Java.CallObjectMethod
- Java.GetObjectField
- Java.GetStaticField
- Java.Initialized
- Java.NewClassObject
- Java.SetObjectField
- Java.SetStaticField
- OCR.Initialize
- Path.FileMakerPathToNativePath
- WIA.Initialize
Release notes
- Version 13.2
- Fixed a problem which prevents Java.Initialize to initialize on macOS and Linux with current JDK 19.
- Version 11.3
- Changed Java.Initialize to not to try to load JavaVM.framework, which results in a crash on Big Sur.
- Version 10.0
- Updated Java.Initialize to better find Java libraries.
- Version 9.4
- Improved Java search for Java.Initialize function on Windows to find jvm.dll.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 13.2pr1
- MBS FileMaker Plugin, version 11.3pr7
- MBS FileMaker Plugin, version 10.0pr8
- MBS FileMaker Plugin, version 9.4pr2
- MBS FileMaker Plugin, version 6.5pr4
This function checks for a license.
Created 2nd October 2016, last changed 19th August 2020