aspose file tools*
The moose likes Linux / UNIX and the fly likes how to get output string parameter from Java  to shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "how to get output string parameter from Java  to shell script" Watch "how to get output string parameter from Java  to shell script" New topic
Author

how to get output string parameter from Java to shell script

Eung maeng
Ranch Hand

Joined: Feb 10, 2002
Posts: 68
Hi,
Does anyone know how to get output string parameter from Java to shell script. which means when shell script execute a java with input string parameter(20 bytes) and Java program return an output string parameter.

is that possible to return a string to sell script?
if so, how java can return and how to retrieve this string output value from shell script progtam.

welcome any opinion,

thanks,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Not really a String per se, but you can get at the output stream of the script process; that's pretty close to being the same thing. See here for hints on how to proceed.


Ping & DNS - my free Android networking tools app
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

I understand the question the other way round, Ulf.

Sending 20 bytes to Java can be done in two ways: As inputstream or by arguments.

Method 1:


call it:


grab the output in the shell:


Using a parameter works this way:


and is called

simply using

will not work, since date responds with
Sa 15 Dez 21:14:37 CET 2007
which is 6 Strings (seperated by whitespace).
Masking them with "..." glues them together with blanks inside.
If your bytes aren't printable, it might be useful as well to mask them.

grab the output in the shell:


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get output string parameter from Java to shell script