• Post Reply Bookmark Topic Watch Topic
  • New Topic

call C program from Java

 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Can anyone tell me, How to call C program method from java class.
Please let me, what are the various exception will occur the moment we call.

Thanks in advance
Narasimha
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API to for calling C code is called JNI.

If you just want to start a program, you can do that using the ProcessBuilder class or the Runtime.exec method.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call a C program from a Java class using the J2EE Connector Architecture API.

http://java.sun.com/j2ee/connector/
 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont want J2EE enterprise Connnector architecture.
My simple requirement is : I would like to get some fuctionality, which is there in C program.

Thank in advance.
will appreciate for your replies.

Thanks
Narasimha
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If neither of the suggestions I made are practical (why not?) you'll have a hard time getting this to work.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont want J2EE enterprise Connnector architecture.
My simple requirement is : I would like to get some fuctionality, which is there in C program.


Ok. However, you asked a question and I gave you an answer. You can get the functionality of the C program with the JCA API. (See link above more info)

Good luck!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!