• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running JNI on eclipse

 
Rajiv Chelsea
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi buddies,

Can anyone tell me how can we run a JNI example (simple HelloWorld example)
using eclipse?

I mean how to create the native lang library using eclipse? Is this feature available on eclipse?

Thanks in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the run properties you need to add -Djava.library.path=X, with X being the path where the DLL is located.
 
Rajiv Chelsea
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.lkn.ei.tum.de/arbeiten/faq/man/JAVA-tutorial/native1.1/index.html

Hi Rob

I am referring the above article to learn about JNI

Can you please list out the steps i need to follow to run this
example using eclipse?
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah right.

Writing native methods involves 3 steps:
1) create the headers. javah can create C/C++ headers for you.
2) implement the functions declared in the headers. Perhaps you can use the C++ plugin for Eclipse for that.
3) compile the code. Again, perhaps the C++ plugin will do that.

I'm sure you can find some useful links with eclipse jni.
 
Rajiv Chelsea
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i create C header files ?
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't I just say that? Also check eclipse generate jni headers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic