You can use xargs .
Given the arguments.in file with the following contents:
~/dev/code$ more arguments.in -version
Called like this:
~/dev/code$ cat arguments.in | xargs $JAVA_HOME/bin/java
Produces this output (i.e. the same output as when calling java -version ):
java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
Note: it is assumed that you are either on the * nix operating system, or are using Cygwin (or a simulator emulator, such as GOW ).
source share