Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running a Java Program from a C program

 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I have written a C program.Inside that i have called system("java JavaProg");.It is working fine but still the java process is terminated the C process is running.I want when the java process terminates normally or abruptly C process should automatically terminate.How to do it ?

Thanks,
Arka
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the part of the C program that runs the Java program?
 
Brian Overland
author
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I would need to seed the C program as well. You may need to make sure that the main() function is declared as int, and returns 0 to the operating system... or you may even need to exit explicitly by call an op-sys function. That's what springs to my mind.

I wish I knew more about the paticular code and the environment from which you are running.

BrianO.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic