Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Java Native Interface

  Asked By: Emily    Date: Feb 10    Category: Java    Views: 773
  

Does anyone have any experience with JNI? I am trying to startup a
JVM as a subsystem of a C++ program but I'm having trouble figuring
out exactly how to get the JVM started. Here's my code:

JavaVM *jvm;
JNIEnv *env;
JavaVMInitArgs vm_args;
vm_args.version = JNI_VERSION_1_4;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

This linker can't find implementations for JNI_CreateJavaVM() or
JNI_GetDefaultJavaVMInitArgs() yet they're declared in jni.h

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Helene Stewart     Answered On: Feb 10

Does anyone have any experience with JNI? I am trying to startup  a
JVM as a subsystem of a C++ program  but I'm having trouble  figuring
out exactly how to get the jvm  started. Here's my code:

JavaVM *jvm;
JNIEnv *env;
JavaVMInitArgs vm_args;
vm_args.version = JNI_VERSION_1_4;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

This linker can't find  implementations for JNI_CreateJavaVM() or
JNI_GetDefaultJavaVMInitArgs() yet they're declared in jni.h

 
Answer #2    Answered By: Feodora Bonkob     Answered On: Feb 10

Do you happen to know off the top of your head the path to the JNI
library?

 
Answer #3    Answered By: Della Simpson     Answered On: Feb 10

Nope... It will most likely vary based on the VM and platform you are using.
For instance, on my Gentoo Linux box it is
in /opt/blackdown-jdk-1.4.2_rc1/jre/lib/i386/. I believe that (don't quote
me on this) the Sun RPM for Redhat linux puts links to the libraries
in /usr/lib/, and puts the actual libraries somewhere
under /usr/sun-jdk-1.4.2/. I suspect that everything you need can be found
in %JAVA_HOME%\jre\lib\i386 on Windows, but I don't currently have access to
a windows box to verify that.

 
Answer #4    Answered By: Devrim Yilmaz     Answered On: Feb 10

For those who may be interested, http://www.ikvm.net has Java/C#
integration solution. I have yet to test it out but it claims to be a
JVM written in C# so you can ustilize Java classes within the CLR.
Interesting ....

 
Didn't find what you were looking for? Find more on Java Native Interface Or get search suggestion and latest updates.




Tagged: