Platform-specific notes for the JVM
Unix-based platforms
The JAVA_HOME environment variable must be set to use the Java interface on Unix-based platforms platforms.
If needed, the LD_LIBRARY_PATH environment variable can contain the path to the JVM library. This is however not required if JAVA_HOME is properly set.
Microsoft™ Windows®
The JAVA_HOME environment variable must be set to use the Java interface on Microsoft Windows platforms.
If needed, the PATH environment variable can contain the path to the JVM library. This is however not required if JAVA_HOME is properly set.
If PATH is defined to find the javac
compiler or JVM
library, make sure that it does not contain double quotes around the path to the
JVM.DLL dynamic library, otherwise the DLL loader will fail to load the
JVM.
See also Microsoft Windows platform notes.
Apple® macOS®
The JAVA_HOME environment variable must be set to use the Java interface on macOS.
export JAVA_HOME=`/usr/libexec/java_home`
On macOS™, the usage of DYLD_LIBRARY_PATH is strongly discouraged, especially since Mac OS X 10.11 this environment variable is no longer exported in sub processes.
The Genero runtime system uses the Java Native Interface (JNI) to interact with the JVM and execute Java code.
By default on macOS®, the JNI feature may not be activated.
$ /usr/libexec/java_home
Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
-t JNI
option:$ /usr/libexec/java_home -t JNI
Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
If the output is empty or reports an older version, JNI is not enabled for the default Java installation.
$ sudo vi `/usr/libexec/java_home`/../Info.plist
<string>JNI</string>
" in the <array>
of the JVMCapabilities
key: <dict>
<key>JVMCapabilities</key>
<array>
<string>CommandLine</string>
<string>JNI</string>
</array>
See also Apple macOS platform notes.
Android™
The Java Interface can be used in Genero apps built for the Android / GMA platform.
JDK 17 is required to build Android apps. For the latest information regarding system requirements and Java support, please refer to the Supported platforms and databases document, available on the "Products" download page of the Four Js Web site.
On Android
devices, some system functions can only be accessed in the context of a JVM. Use the Java Interface with the
com.fourjs.gma.vm.FglRun
class to access such system specifics. Custom Java classes
need to be part of the .apk package and can be used without any further
configuration.
For more details, see Executing Java code with GMA.
iOS
The Java interface cannot be used in apps running on iOS devices: There is no standard free JVM available.
IBM® AIX®
Consider the following notes when using the Java Interface with the IBM Java VM on AIX:
If you get java.lang.UnsatisfiedLinkError
exceptions, set the path to native
shared libraries in the LIBPATH environment variable:
$ LIBPATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/j9vm:$JAVA_HOME/jre/lib/ppc64:$LIBPATH
$ export LIBPATH
This is required when using Java code that needs to access native code supplied as part of the JRE. For example, without setting LIBPATH to the appropriate path, the JVM cannot find the shared library libnet.so.
Using the -Djava.library.path=path-to-native-library
java VM
option does not seem to help.
See also IBM AIX platform notes.