1

Can anybody help me find a tutorial on creating JNI applications using eclipse on the ubuntu platform?

I am finding tutorials for the windows platform, but not for Ubuntu or Linux system.

dsgriffin
  • 66,495
  • 17
  • 137
  • 137
Prasad
  • 1,375
  • 5
  • 17
  • 31
  • 1
    I don't think that the Java side of things is any different, but rather it's the C/C++ side which will be platform specific. What type of tutorial are you looking for? How to compile and link C/C++ code with Eclipse? – Hovercraft Full Of Eels Sep 15 '12 at 14:28
  • I am able to create header file but not .so file. how to do this in ubuntu platform using eclipse. to create library file in windows is dll format. but what is in ubuntu?? – Prasad Sep 15 '12 at 14:33
  • This may be compiler dependent. Which C/C++ compiler are you using? – Hovercraft Full Of Eels Sep 15 '12 at 14:33
  • Yep, the GNU Compiler Collection comes with Ubuntu I think. Have you looked [here](http://developer.ubuntu.com/resources/programming-languages/c-and-c-plus-plus/) yet? There are also Eclipse-specific tut's available through Google. – Hovercraft Full Of Eels Sep 15 '12 at 14:36
  • Also, Google gave me [this](http://www.ibm.com/developerworks/opensource/library/os-ecc/). It's a bit old, but still has relevant information. – Hovercraft Full Of Eels Sep 15 '12 at 14:45
  • @HovercraftFullOfEels: I searched but i did't get tut's in google specific to ubuntu :( – Prasad Sep 15 '12 at 14:45
  • Again, tutorials for what specifically? – Hovercraft Full Of Eels Sep 15 '12 at 14:46
  • @HovercraftFullOfEels: in eclipse property->c/c++ build->settings--> GCC Linker---> miscellaneous--->Linker flags I added -Wl,--add-stdcall-alias. but this is not working. I think this is foe window. I have to give this for ubuntu. this is am not getting – Prasad Sep 15 '12 at 15:24
  • @Prasad: what's not working? show some error messages eclipse gives you. there are no mind readers here. – Denis Tulskiy Sep 15 '12 at 15:31
  • @HovercraftFullOfEels: I am using "http://www.lithiumhead.com/notes/windows_jni" this link for JNI I created .h file successfuly but problem is like Multiple markers at this line - fatal error: ..\01Java_HelloWorld\com_lithiumhead_jni_HelloWorld.h: No such file or directory in a c file – Prasad Sep 15 '12 at 15:42
  • @Prasad: replace \ with / on unix. I assume you made sure the file is accessible at that path. – Denis Tulskiy Sep 15 '12 at 15:51
  • See also: http://stackoverflow.com/questions/1624344/developing-jni-applications-with-eclipse-combined-java-c?lq=1 – StockB Jan 10 '13 at 21:01

1 Answers1

0

look to JNA. It is easier. No boilerplate or generated glue code is required.

Jiri Kremser
  • 12,471
  • 7
  • 45
  • 72
  • There are several valid reasons for using JNI over JNA: http://stackoverflow.com/questions/1556421/use-jni-instead-of-jna-to-call-native-code – StockB Jan 07 '13 at 17:00