Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.