Create the JVM

The corresponding JniEnv can be obtained by calling env.

Unavailable on some platforms, including Android where you cannot instanciate a new JVM.

Property definitions

jvm $ JavaVM :: new
	# Create the JVM
	#
	# The corresponding `JniEnv` can be obtained by calling `env`.
	#
	# Unavailable on some platforms, including Android where you cannot instanciate a new JVM.
	private new(args: JavaVMInitArgs) import jni_error `{

	#ifdef ANDROID
		JavaVM_jni_error(NULL, "JVM creation not supported on Android", 0);
		return NULL;
	#endif

		JavaVM *jvm;
		JNIEnv *env;
		jint res;

		res = JNI_CreateJavaVM(&jvm, (void**)&env, args);

		if (res != JNI_OK) {
			JavaVM_jni_error(NULL, "Could not create Java VM", res);
			return NULL;
		}

		return jvm;
	`}
lib/jvm/jvm.nit:134,2--158,3