Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

call C program from Java

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic