Creates a JVM for use when main is in D. Keep the returned
struct around until you are done with it. While this struct
is live, you can use imported Java classes and methods almost
as if they were written in D.
If main is in Java, this is not necessary and should not be
used.
You can optionally pass a JavaVMOption[] to provide options
to the JVM when it starts, e.g.
JavaVMOption("-Djava.compiler=NONE") to disable JIT,
JavaVMOption("-verbose:jni") to print JNI-related messages,
JavaVMOption(-Djava.class.path=c:\Users\me\program\jni\)`
to specify the path to user classes or
`JavaVMOption(-Djava.library.path=c:\Users\me\program\jdk-13.0.1\lib\);`
to set native library path
This function will try to load the jvm with dynamic runtime
linking. For this to succeed:
On Windows, make sure the path to jvm.dll is in your PATH
environment variable, or installed system wide. For example:
set PATH=%PATH%;c:\users\me\program\jdk-13.0.1\bin\server
On Linux (and I think Mac), set LD_LIBRARY_PATH environment
variable to include the path to libjvm.so.
export LD_LIBRARY_PATH=/home/me/jdk-13.0.1/bin/server
--- or maybe ---
LD_LIBRARY_PATH=/opt/android/android-studio/jre/jre/lib/amd64/server ./myjvm
Failure to do this will throw an exception along the lines of
"no jvm dll" in the message. That error can also be thrown if
you have a 32 bit program but try to load a 64 bit JVM, or vice
versa.
Returns:
an opaque object you should hold on to but not actually use.
Its destructor does necessary cleanup tasks to unload the jvm
but otherwise its effect is global.
As long as that object is in scope, you can work with java classes
globally and it will use that jvm's environment and load classes and jars
through the java classpath.
Creates a JVM for use when main is in D. Keep the returned struct around until you are done with it. While this struct is live, you can use imported Java classes and methods almost as if they were written in D.
If main is in Java, this is not necessary and should not be used.
You can optionally pass a JavaVMOption[] to provide options to the JVM when it starts, e.g. JavaVMOption("-Djava.compiler=NONE") to disable JIT, JavaVMOption("-verbose:jni") to print JNI-related messages, JavaVMOption(-Djava.class.path=c:\Users\me\program\jni\)` to specify the path to user classes or `JavaVMOption(-Djava.library.path=c:\Users\me\program\jdk-13.0.1\lib\);` to set native library path
This function will try to load the jvm with dynamic runtime linking. For this to succeed:
On Windows, make sure the path to jvm.dll is in your PATH environment variable, or installed system wide. For example:
On Linux (and I think Mac), set LD_LIBRARY_PATH environment variable to include the path to libjvm.so.
Failure to do this will throw an exception along the lines of "no jvm dll" in the message. That error can also be thrown if you have a 32 bit program but try to load a 64 bit JVM, or vice versa.
Returns: an opaque object you should hold on to but not actually use. Its destructor does necessary cleanup tasks to unload the jvm but otherwise its effect is global.
As long as that object is in scope, you can work with java classes globally and it will use that jvm's environment and load classes and jars through the java classpath.