Crate jni_simple

Source
Expand description

§jni-simple

This crate contains a simple dumb handwritten rust wrapper around the JNI (Java Native Interface) API. It does absolutely no magic around the JNI Calls and lets you just use it as you would in C.

If you are looking to start a jvm from rust then the entrypoints in this create are init_dynamic_link, load_jvm_from_library, JNI_CreateJavaVM and JNI_GetCreatedJavaVMs.

If you are looking to write a jni library in rust then the types JNIEnv and jclass, etc. should be sufficient.

Macros§

jtypes
This macro is usefull for constructing jtype arrays. This is often needed when making upcalls into the jvm with many arguments using the ‘A’ type functions:

Structs§

JNIEnv
JNINativeMethod
JavaVM
JavaVMAttachArgs
JavaVMInitArgs
JavaVMOption

Enums§

jobjectRefType

Constants§

JNI_ABORT
JNI_COMMIT
JNI_EDETACHED
JNI_EEXIST
JNI_EINVAL
JNI_ENOMEM
JNI_ERR
JNI_EVERSION
JNI_OK
JNI_VERSION_9
JNI_VERSION_1_1
JNI_VERSION_1_2
JNI_VERSION_1_4
JNI_VERSION_1_6
JNI_VERSION_1_8
JNI_VERSION_10
JNI_VERSION_19
JNI_VERSION_20
JNI_VERSION_21

Traits§

JType
Marker trait for all types that are valid to use to make variadic JNI Up-calls with.
UseCString
Helper trait that converts rusts various strings into a zero terminated c string for use with a JNI method.

Functions§

JNI_CreateJavaVM
Directly calls JNI_CreateJavaVM with the provided arguments.
JNI_CreateJavaVM_with_string_args
Convenience function to call JNI_CreateJavaVM with a simple list of String arguments.
JNI_GetCreatedJavaVMs
Returns the created JavaVMs. This will only ever return 1 (or 0) JavaVM according to Oracle Documentation.
init_dynamic_link
Call this function to initialize the dynamic linking to the jvm to use the provided function pointers to create the jvm.
is_jvm_loaded
Returns true if the jvm was loaded by either calling load_jvm_from_library or init_dynamic_link.
load_jvm_from_java_home
Convenience method to load the jvm from the JAVA_HOME environment variable that is commonly set on Windows by End-User Java Setups, or on linux by distribution package installers.
load_jvm_from_library
Convenience method to load the jvm from a path to libjvm.so or jvm.dll.

Type Aliases§

jarray
jboolean
jbooleanArray
jbyte
jbyteArray
jchar
jcharArray
jclass
jdouble
jdoubleArray
jfieldID
jfloat
jfloatArray
jint
jintArray
jlong
jlongArray
jmethodID
jobject
jobjectArray
jshort
jshortArray
jsize
jstring
jthrowable
jweak

Unions§

jtype