Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

call a java program from a webapp in tomcat server - the java program is out side of tomcat server

I have a webapp in tomcat server. also i have a java program outside the tomcat server - in linux machine root. i need to call the java program outside and get a response to the webapp. is this possible to do?

Please give me an answer?

Thanks in advance.

like image 453
Ruwan Dissanayaka Avatar asked Jan 21 '26 07:01

Ruwan Dissanayaka


1 Answers

You can use exec method on runtime object:

Runtime rt = Runtime.getRuntime(); 
Process proc = rt.exec("whatever_you_want_to_run"); 
int exitVal = proc.exitValue();
like image 61
Jiri Kremser Avatar answered Jan 23 '26 21:01

Jiri Kremser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!