#include "jnilib.h"
#include <stdarg.h>
Include dependency graph for jnilib.c:
Go to the source code of this file.
Defines | |
#define | CLASSPATH_PARAM "-Djava.class.path=" |
Defines the name of the classpath parameter for the Jvm. | |
#define | CLS_JNILIB "at/fhv/sgr/jnilib/JNILIB" |
Defines the full name of the Java JNILIB-Class. | |
#define | createJvm createJvmC |
Defines which function to call when createJvm is called. | |
#define | DEFAULT_CLASSPATH "." |
Defines the default classpath. | |
#define | JNILIB_ENV (*(getJNIEnv())) |
Defines the acces to a JNIEnv structure by getJNIEnv(). | |
#define | JNILIB_GETJAVAVM (*getJavaVM()) |
Defines the acces to a JavaVM structure by getJavaVM(). | |
#define | JNILIB_GETJAVAVM_PARAM getJavaVM(), |
Defines the getJavaVM() function parameter. | |
#define | JNILIB_JAVAVM (*(jvm->jvm.jvm)) |
Defines the acces to a JavaVM structure. | |
#define | JNILIB_PARAM_END_ENV getJNIEnv() |
Defines the getJNIEnv() function parameter without comma. | |
#define | JNILIB_PARAM_END_JVM jvm |
Defines the jvm function parameter without comma. | |
#define | JNILIB_PARAM_ENV getJNIEnv(), |
Defines the getJNIEnv() function parameter. | |
#define | JNILIB_PARAM_JAVAVM jvm->jvm.jvm |
Defines the JavaVM function parameter. | |
#define | JNILIB_PARAM_JVM jvm, |
Defines the jvm function parameter. | |
Functions | |
jboolean | callBooleanMethod (jobject obj, jmethodID mid,...) |
Calls a boolean method. | |
jboolean | callBooleanMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a boolean method. | |
jbyte | callByteMethod (jobject obj, jmethodID mid,...) |
Calls a byte method. | |
jbyte | callByteMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a byte method. | |
jchar | callCharMethod (jobject obj, jmethodID mid,...) |
Calls a char method. | |
jchar | callCharMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a char method. | |
jdouble | callDoubleMethod (jobject obj, jmethodID mid,...) |
Calls a double method. | |
jdouble | callDoubleMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a double method. | |
jfloat | callFloatMethod (jobject obj, jmethodID mid,...) |
Calls a float method. | |
jfloat | callFloatMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a float method. | |
jint | callIntMethod (jobject obj, jmethodID mid,...) |
Calls an int method. | |
jint | callIntMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls an int method. | |
jlong | callLongMethod (jobject obj, jmethodID mid,...) |
Calls a long method. | |
jlong | callLongMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a long method. | |
jobject | callObjectMethod (jobject obj, jmethodID mid,...) |
Calls a object method. | |
jobject | callObjectMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a object method. | |
jshort | callShortMethod (jobject obj, jmethodID mid,...) |
Calls a short method. | |
jshort | callShortMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a short method. | |
jint | callStaticIntMethod (jclass cls, jmethodID mid,...) |
Calls a static int method. | |
jobject | callStaticObjectMethod (jclass cls, jmethodID mid,...) |
Calls a static object method. | |
void | callStaticVoidMethod (jclass cls, jmethodID mid,...) |
Calls a static void method. | |
void | callVoidMethod (jobject obj, jmethodID mid,...) |
Calls a void method. | |
void | callVoidMethodByName (jobject obj, const char *method, const char *signature,...) |
Calls a void method. | |
char * | convertJString (jstring jstr) |
Creates a native char* from a jstring. | |
jobject | createGlobalReference (jobject obj) |
Creates a global reference of a Java-Object and deletes the local reference. | |
jstring | createJString (const char *str) |
Creates a jstring from a native char*. | |
void | createJvm_ (Jvm_ *jvm) |
Initialize the Jvm_ structure by setting the function pointers. | |
void | createJvmC (Jvm_ *jvm) |
Function is called when working with C and calling the function createJvm. | |
void | createJvmCPP (JvmCPP_ *jvm) |
Function is called when working with C++ and calling the function createJvm. | |
void | deleteGlobalReference (jobject obj) |
Deletes a global reference. | |
void | deleteLocalReference (jobject obj) |
Deletes a local reference. | |
jint | destroyJvm (Jvm *jvm) |
Unloads the Jvm. | |
jboolean | exception () |
Tests if an exception was thrown and prints the exception. | |
jclass | findClass (const char *strclass) |
Finds the Java class specified by strclass. | |
jmethodID | findMethod (jclass cls, const char *method, const char *signature) |
Finds a method of a Java class. | |
jfieldID | findStaticField (jclass cls, const char *field, const char *signature) |
Finds a static field of a Java class. | |
jmethodID | findStaticMethod (jclass cls, const char *method, const char *signature) |
Finds a static method of a Java class. | |
JavaVM * | getJavaVM () |
Gets a Pointer to the current JavaVM structure. | |
JNIEnv * | getJNIEnv () |
Gets a Pointer to the actual JNIEnv structure. | |
jclass | getObjectClass (jobject obj) |
Gets the Class of the Java-Object. | |
jint | getStaticIntFieldByName (const char *strclass, const char *strfield) |
Gets the value of a class field. | |
jobject | getStaticObjectFieldByName (const char *strclass, const char *strfield, const char *signature) |
Gets the value of a class field. | |
void | initJvm (Jvm *jvm, const char *classpath) |
Initializes and creates the Jvm. | |
jboolean | isSameObject (jobject obj1, jobject obj2) |
Compares 2 objects if they are the same or not. | |
void | jnisleep (jint ms) |
Sleeps for ms milliseconds. | |
jobject | newObject (jclass cls, jmethodID mid,...) |
Creates a new Object of a Class. | |
jobject | newObjectBySignature (jclass cls, const char *signature,...) |
Creates a new Object of a Class. | |
jint | registerNatives (jclass cls, const JNINativeMethod *nm, jint nMethods) |
Resgisters a native function pointer as native function in a Java-Class. | |
void | setJvmClasspath (Jvm *jvm, const char *cp) |
Sets the Classpath for the Jvm structure. | |
jint | startJvm (Jvm *jvm) |
Initializes and creates the Virtual Machine. | |
void | throwByName (const char *name, const char *msg) |
Throws an Throwable by name. | |
Variables | |
JavaVM * | javavm = NULL |
Holds the created JavaVM. |
These functions and structures provide access to a JVM. You can initialize a JVM instance and create objects and call methods by using these functions. Also some helper functions can be found here.
Definition in file jnilib.c.
|
Defines the name of the classpath parameter for the Jvm.
|
|
Defines the full name of the Java JNILIB-Class.
|
|
Defines which function to call when createJvm is called.
|
|
Defines the default classpath.
|
|
Defines the acces to a JNIEnv structure by getJNIEnv().
|
|
Defines the acces to a JavaVM structure by getJavaVM().
|
|
Defines the getJavaVM() function parameter.
|
|
Defines the acces to a JavaVM structure.
|
|
Defines the getJNIEnv() function parameter without comma.
|
|
Defines the jvm function parameter without comma.
|
|
Defines the getJNIEnv() function parameter.
|
|
Defines the JavaVM function parameter.
|
|
Defines the jvm function parameter.
|
|
Calls a boolean method.
|
|
Calls a boolean method.
|
|
Calls a byte method.
|
|
Calls a byte method.
|
|
Calls a char method.
|
|
Calls a char method.
|
|
Calls a double method.
|
|
Calls a double method.
|
|
Calls a float method.
|
|
Calls a float method.
|
|
Calls an int method.
|
|
Calls an int method.
|
|
Calls a long method.
|
|
Calls a long method.
|
|
Calls a object method.
|
|
Calls a object method.
|
|
Calls a short method.
|
|
Calls a short method.
|
|
Calls a static int method.
|
|
Calls a static object method.
|
|
Calls a static void method.
|
|
Calls a void method.
|
|
Calls a void method.
|
|
Creates a native char* from a jstring.
|
|
Creates a global reference of a Java-Object and deletes the local reference.
|
|
Creates a jstring from a native char*.
|
|
Initialize the Jvm_ structure by setting the function pointers.
|
|
Function is called when working with C and calling the function createJvm. It initializes the Jvm_ structure.
|
|
Function is called when working with C++ and calling the function createJvm. It initializes the JvmCPP_ structure.
|
|
Deletes a global reference.
|
|
Deletes a local reference.
|
|
Unloads the Jvm.
|
|
Tests if an exception was thrown and prints the exception.
|
|
Finds the Java class specified by strclass.
|
|
Finds a method of a Java class.
|
|
Finds a static field of a Java class.
|
|
Finds a static method of a Java class.
|
|
Gets a Pointer to the current JavaVM structure.
|
|
Gets a Pointer to the actual JNIEnv structure.
|
|
Gets the Class of the Java-Object.
|
|
Gets the value of a class field.
|
|
Gets the value of a class field.
|
|
Initializes and creates the Jvm.
|
|
Compares 2 objects if they are the same or not.
|
|
Sleeps for ms milliseconds.
|
|
Creates a new Object of a Class.
|
|
Creates a new Object of a Class.
|
|
Resgisters a native function pointer as native function in a Java-Class.
|
|
Sets the Classpath for the Jvm structure.
|
|
Initializes and creates the Virtual Machine.
|
|
Throws an Throwable by name.
|
|
Holds the created JavaVM.
|