Now I have some C source codes, I would like to use it in my java application. I need to execute the C source code, and get back the result to my java application. Instead of re-write all the C source code to java, how can I reuse the C's source code in my java application?
Take a look at Java Native Interface.
The Java Native Interface (JNI) is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and to be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages such as C, C++ and assembly.
There are the following ways.
Two options:
Yes its possible Take a look at
Calling C Code from Java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With