• Post Reply Bookmark Topic Watch Topic
  • New Topic

executing 'c' program using java

 
bala chidambaram
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I came to know that c program can be executed using java. please help me to understand the concept.

Thank u
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you want a C program to interact with a Java program, you can use JNI, as I understand. JNI = Java Native Interface. You could, for example, write a library of functions in C, and have your Java program load up the library and call the functions. There are rules about how to convert types and make calls. There is an online tutorial on JNI at Sun...check out the J2SE docs under JNI for details.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ALternatively, if it's a standalone program you've got, then you can launch it using the java.lang.Runtime.exec() family of methods. JNI is for linking C and Java code together into one process.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!