• 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
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

c calling java program

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

is it like this?
 
reply
    Bookmark Topic Watch Topic
  • New Topic