Runtime.Load(String) Method

Definition

Loads the native library specified by the filename argument.

[Android.Runtime.Register("load", "(Ljava/lang/String;)V", "GetLoad_Ljava_lang_String_Handler")]
public virtual void Load (string? filename);
[<Android.Runtime.Register("load", "(Ljava/lang/String;)V", "GetLoad_Ljava_lang_String_Handler")>]
abstract member Load : string -> unit
override this.Load : string -> unit

Parameters

filename
String

the file to load.

Attributes

Exceptions

if the library can not be loaded, either because it's not found or because there is something wrong with it.

Remarks

Loads the native library specified by the filename argument. The filename argument must be an absolute path name. (for example Runtime.getRuntime().load("/home/avh/lib/libX11.so");).

If the filename argument, when stripped of any platform-specific library prefix, path, and file extension, indicates a library whose name is, for example, L, and a native library called L is statically linked with the VM, then the JNI_OnLoad_L function exported by the library is invoked rather than attempting to load a dynamic library. A filename matching the argument does not have to exist in the file system. See the JNI Specification for more details.

Otherwise, the filename argument is mapped to a native library image in an implementation-dependent manner.

First, if there is a security manager, its checkLink method is called with the filename as its argument. This may result in a security exception.

This is similar to the method #loadLibrary(String), but it accepts a general file name as an argument rather than just a library name, allowing any file of native code to be loaded.

The method System#load(String) is the conventional and convenient means of invoking this method.

Java documentation for java.lang.Runtime.load(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to