it is a simple question how can i access a method which is written in C language by a java application.
-
JNI is what you're looking for. – Olavi Mustanoja Jan 15 '15 at 10:14
-
using pointer in c program now i want to access this c program in my java application, – Sanjay Kumar Jan 15 '15 at 10:17
-
"its a simple question" -> exactly, so it is already asked numerous times. http://stackoverflow.com/questions/5963266/call-c-function-from-java – Gimby Jan 15 '15 at 10:31
1 Answers
You options include:
Java Native Interface
see: https://en.wikipedia.org/wiki/Java_Native_Interface
quote:
JNI enables programmers to write native methods to handle situations when an application cannot be written entirely in the Java programming language, e.g. when the standard Java class library does not support the platform-specific features or program library
Java Native Access
see: https://en.wikipedia.org/wiki/Java_Native_Access
quote:
Java Native Access is a community-developed library that provides Java programs easy access to native shared libraries without using the Java Native Interface.
JNR-FFI
see: https://github.com/jnr/jnr-ffi
quote:
jnr-ffi is a java library for loading native libraries without writing JNI code by hand, or using tools such as SWIG.

- 2,844
- 1
- 25
- 41
-
-
@PeterLawrey isn't JNA the [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface) for java? – Dawnkeeper Jan 15 '15 at 10:30
-
-
1