Reputation: 30558
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?
Upvotes: 11
Views: 28179
Reputation: 115328
There are the following ways.
Upvotes: 9
Reputation: 32831
Two options:
Upvotes: 6
Reputation: 22142
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.
Upvotes: 14