Unknown error reported in the JNI "JNI_CreateJavaVM"

David Holmes David.Holmes at oracle.com
Wed Sep 15 00:43:46 PDT 2010


Sylvestre Ledru said the following on 09/15/10 17:17:
> As suggested in the bug report:
> http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=553
> I am contacting you about an small issue.
> 
> Starting the JVM a few times with "JNI_CreateJavaVM" may lead to an
> error JNI_ERR ("unknown error").
> However, it could return JNI_EEXIST ("VM already created") which will be
> more interesting to manage the error and debugging. This error code is
> already defined in jni.h.

This is a curious part of the JNI spec as it doesn't actually define a 
set of error codes, even though jni.h does contain a few, including 
JNI_EEXIST. But at least we aren't constrained by the spec as 
CreateJavaVM is allowed to return a "a suitable JNI error code (a 
negative number) on failure".

The question is, is it too late to change this? Any code that checks for 
JNI_ERR will now be broken, but code that checks for !JNI_OK will be fine.

David Holmes

> Thanks for considering the (tiny) patch.
> 
> Regards,
> Sylvestre
> 
> 
> 
> 
> 


More information about the hotspot-dev mailing list