wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes running JNI on eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "running JNI on eclipse" Watch "running JNI on eclipse" New topic
Author

running JNI on eclipse

Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
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

Joined: Oct 27, 2005
Posts: 19651
    
  18

In the run properties you need to add -Djava.library.path=X, with X being the path where the DLL is located.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
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

Joined: Oct 27, 2005
Posts: 19651
    
  18

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

Joined: Jun 15, 2010
Posts: 88
How do i create C header files ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Didn't I just say that? Also check eclipse generate jni headers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: running JNI on eclipse
 
Similar Threads
how to pass Strng array from java to c Using JNI
change the file format
JNI
How to lock java app for single PC
regarding JNI