Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java Language
Expertise: Beginner
Jun 6, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Return Values from Java to Unix

I am calling a java program from a Unix script and passing three parameters. Once the Java program is done, I want to return two values back to the Unix program from the Java program.

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

The simplest, and perhaps best, way to do this is to print the values to standard output and parse them in the script. It is normal for shell scripts to use the printed output of other programs in one way or another.

Another alternative is to write the values to a file. Other forms of interprocess communication can be used, but provide overly complicated solutions for the simple case of returning values to a script.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date