File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pass parameters from shell to java stdin

 
Geraldine Premkumar
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a shell script that calls java program. I need to pass parameters not as command line arguments to the java program but to java's standard input. Is there a way to do this in the shell script. I do know that < redirects I/O but how do I apply it here since I want to send only specific parameters and not the entire contents of the file.
I am very new to shell scripts and really appreciate any pointers.

Thanks
Geraldine
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17639
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a "here script" is what you'd like:

java myprogram <<END
$PARAM_1
$PARAM_2
$PARAM_3
END

Everything between the delimiters ("END") is piped into stdin, with shell subsistutions being done as required.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic