Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return code of JNI_CreateJavaVM

I found the http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html

was the documentation of JNI call funcitons.

But for example if I call:

JNI_CreateJavaVM

There is this technotes:

https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/invocation.html#JNI_CreateJavaVM

I know the return code is a jint telling me:

  • if the return of the function is 0 ok
  • if the return of the funciton is negative is not ok or some issue.

The above documentation of the method JNI_CreateJavaVM says:

RETURNS:
Returns JNI_OK on success; returns a suitable JNI error code (a negative number) on failure.

But I dont know exactly what is the the real result because it does not say the possible error codes.

So I can't create any JVM because it gives me a *jvm pointer null, and the ERROR CODE is -1.

Is there a "javadoc" of JNI?

like image 595
felipe Avatar asked May 05 '17 17:05

felipe


1 Answers

jni.h defines the possible return values for JNI functions:

#define JNI_OK           0                 /* success */
#define JNI_ERR          (-1)              /* unknown error */
#define JNI_EDETACHED    (-2)              /* thread detached from the VM */
#define JNI_EVERSION     (-3)              /* JNI version error */
#define JNI_ENOMEM       (-4)              /* not enough memory */
#define JNI_EEXIST       (-5)              /* VM already created */
#define JNI_EINVAL       (-6)              /* invalid arguments */
like image 188
wero Avatar answered Nov 08 '22 07:11

wero