[英]Is it possible to run C source code from Java?
Now I have some C source codes, I would like to use it in my java application. 现在我有一些C源代码,我想在我的java应用程序中使用它。 I need to execute the C source code, and get back the result to my java application. 我需要执行C源代码,并将结果返回到我的java应用程序。 Instead of re-write all the C source code to java, how can I reuse the C's source code in my java application? 而不是将所有C源代码重写到java,我如何在我的Java应用程序中重用C的源代码?
Take a look at Java Native Interface . 看看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. Java Native Interface(JNI)是一个编程框架,它使在Java虚拟机(JVM)中运行的Java代码能够调用并由本机应用程序(特定于硬件和操作系统平台的程序)和用其他语言编写的库调用例如C,C ++和汇编。
There are the following ways. 有以下几种方式。
Two options: 两种选择:
Yes its possible Take a look at 是的可能看一看
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.