I have two .jar file in a pipeline. 1.jar will output two lines, both of which will be the input of 2.jar. Now I want to store the each line of the intermediate output of 1.jar to variables A and B, while allowing 2.jar to take both lines as input.
java -jar 1.jar | XXX | java -jar 2.jar
As a detour, I could do
java -jar 1.jar | tee out | java -jar 2.jar
and read the file to save the variables, but I'd like a more straight-forward way of doing it.