• Post Reply Bookmark Topic Watch Topic
  • New Topic

c calling java program  RSS feed

 
Maalti Iyer
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
Is there a way to call java program from my C program in Solaris environment.
Thanks for your time
Maalti Iyer
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simplest way is to use the system() function. Which spawns a shell and has your program waiting for it return. The argument to system() is a complete string as you'd supply from the shell.
If you want to get fancy with exec/execlp/exec* you can actually replace your program space with the new java process, saving you on the total number of processes.
 
Maalti Iyer
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Leslie.
Here's the requirement:
For every row I read from the database my C program has to call a java class to decrypt the data. I was wondering how to optimize the system() call.
I appreciate your help.
Thanks again,
maalti Iyer.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

is it like this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!