devxlogo

Return Values from Java to Unix

Return Values from Java to Unix

Question:
I am calling a java program from a Unix script and passing threeparameters. Once the Java program is done, I want to return two valuesback to the Unix program from the Java program.

How do I return data backfrom a Java program to a Unix script?

Answer:
The simplest, and perhaps best, way to do this is to print the values tostandard output and parse them in the script. It is normal for shellscripts to use the printed output of other programs in one way oranother.

Another alternative is to write the values to a file. Otherforms of interprocess communication can be used, but provide overlycomplicated solutions for the simple case of returning values to ascript.

devx-admin

Share the Post: