Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Starting with JNI using Eclipse

868282Jun 11 2011 — edited Jun 24 2011
Hi, I've been having tremendous problems with starting to use JNI.

So far, I've tried using C++ with JNI, but it became too difficult because the tutorial I had was for C with JNI.
I then got the eclipse C/C++ IDE then tried using JNI again... But I head to tell eclipse where to locate the JNI.H
I went to my project->properties->C/C++ Build->Settings.
Then I selected Directories which was under GCC C Comiler.
Then I added the two directories:

*1. JAVA_HOME/jdk1.6.0_25\include*
*2. JAVA_HOME/jdk1.6.0_25\include\win32*
where JAVA_HOME is the path to get to where I store my jdk.

Anyways, I first of all wanted to see if JNI would work. And it seemed that It had. However I was having problems with the following function:

JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

I'm not quite sure what this function does, but I do know that it plays a role in implementing a JVM using JNI.

When I try to build my code, I get an error: undefined reference to `_imp__JNI_CreateJavaVM@12'

Well, to be honest, since I am new to all of this JNI coding, I really do not know anything about how I can fix this problem, probably because I've been having so much trouble getting started, and that I've never programmed in C. (I have in C++ though).
__________________________________________________________________________________________________________________________________________________


Basically, I want to ask:
-How can I configure JNI with Eclipse C/C++ IDE?
-How can I configure anything with JNI?
-How can I configure a C compiler if none of the above will work?
-How can I get rid of the error I am having? I did look into it and I was seeing I might need a "Jvm.dll". The only Jvm.dll I found were in my jre\bin in the client and server folders.
-How can I successfully implement the JVM using JNI, so that I can create a custom launcher for program deployment?

I'm sorry I really do not know anything about JNI, and to be honest I wish I did. I came to this forum after several hours of no luck configuring my computer to be able to program using JNI correctly. I really do appreciate any feedback, and I hope that this forum will actually have some traffic, compared to the Java.net forums I normally use.
Thank you in advance, I hope I gave you enough details to the problems I am having with. And I do apologize if I further complicate the issue.

Regards.

Edited by: Nick on Jun 18, 2011 7:39 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2011
Added on Jun 11 2011
9 comments
2,380 views