Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Java Archives

I was wondering if anyone knew how to do the following:

Receive output from running a .jar from another java program.

(The command I run looks similar to this)

java -jar Loader.jar PluginHandler.jar Monitor Screen ...

etc.

Lets say in the PluginHandler

System.out.println("Hi");

was called, how do I receive that output from the Loader?

I need to be able to receive information from on .jar down to the next.

I have some of my program working, but not all of it.

1 Answer

You can use pipes in Linux and also in Windows based computers. The output of the first command would be the input for the second command:

java -jar Loader.jar || java -jar PluginHandler.jar Monitor Screen

At the moment the command runs

java -jar Loader.jar ANYPLUGIN.jar ANOTHERPLUGIN.jar

The loader then loads any plugins that are passed then on after.

I need to then get the output stream of the plugin that runs.

I may try and add it to github and link it if that helps.