Jump to content
Excelsior Forums
powerdroid

A couple questions about Invocation

Recommended Posts

In the Invocation sample "cMain" in the file "test.c", jni.h is included. Is this file from Oracle's jdk? If so, is there a specific version of the jdk that should be used?

Also, there is a section listed below:

/*

* NOTE: no JVM is actually created

* this call to JNI_CreateJavaVM is intended for JET RT initialization

*/

result = JNI_CreateJavaVM_func (pjvm, (void **)penv, &args);

if (result != JNI_OK) {

printf ("JNI_CreateJavaVM() failed with result %d\n", result);

exit(1);

}

What is the flow of what is happening here? Meaning, it appears that the dll is being loaded at "myDllHandle = loadDll (dllname);" prior to the "initJavaRT" being called. What happens when the dll is loaded, if the Jet runtime hasn't been loaded yet?

Also, when this is running, how does the system/code know where the Jet RT files reside (are they expecting them to be in "rt" folder that is packaged with the dll?

Thank you for any help you could give to help me understand the flow of this..

Share this post


Link to post
Share on other sites

In the Invocation sample "cMain" in the file "test.c", jni.h is included. Is this file from Oracle's jdk? If so, is there a specific version of the jdk that should be used?

Also, there is a section listed below:

/*

* NOTE: no JVM is actually created

* this call to JNI_CreateJavaVM is intended for JET RT initialization

*/

result = JNI_CreateJavaVM_func (pjvm, (void **)penv, &args);

if (result != JNI_OK) {

printf ("JNI_CreateJavaVM() failed with result %d\n", result);

exit(1);

}

What is the flow of what is happening here? Meaning, it appears that the dll is being loaded at "myDllHandle = loadDll (dllname);" prior to the "initJavaRT" being called. What happens when the dll is loaded, if the Jet runtime hasn't been loaded yet?

Also, when this is running, how does the system/code know where the Jet RT files reside (are they expecting them to be in "rt" folder that is packaged with the dll?

Thank you for any help you could give to help me understand the flow of this..

loadDll just loads DLL. initJavaRT loads and initializes JET runtime.

Every jet-compiled Invocation DLL exports JNI_CreateJavaVM function that can be used to initialize JET runtime.

Share this post


Link to post
Share on other sites

Thank you Kit. So, can I use a jni.h file from any version of Oracle's jdk? (does it matter which is used?)

As we support Java SE 6 it is recommended to use jni.h from JDK 6 (no matter which microversion). On the other hand, jni.h has not been changed significantly for a long time and changes usually extend previous functionality. So if you do not use unique features of JNI of particular Java version you may use earlier version.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×