How to capture console output of Eclipse plugin with custom Launch Configuration?

admin

Administrator
Staff member
I'm writing an Eclipse plugin with a custom launch configuration, i.e. a
Code:
launch()
method inside a subclass of
Code:
LaunchConfigurationDelegate
. This method essentially just calls
Code:
Runtime.exec()
, but when I write to System.out from within
Code:
launch()
it goes to the console of the Eclipse instance which is debugging the plugin, rather than to the console of the plugin instance itself. I've analysed the
Code:
ILaunchConfiguration
and
Code:
ILaunch
arguments to the method but cannot find anywhere that they specify any output/error streams I can write to.

As is recommended in the tutorials, I have 2 separate plugins running together; one which handles the UI stuff (
Code:
LaunchConfigurationTab
,
Code:
LaunchConfigurationTabGroup
,
Code:
LaunchShortcut
,) and the other which contains the
Code:
LaunchConfigurationDelegate
itself.

I created a console in my UI plugin using <a href="http://www.jevon.org/wiki/Writing_to_a_Console_in_Eclipse" rel="nofollow noreferrer">this code</a>, and I can write to it fine from within the UI code. But I cannot figure out how to direct output generated in my non-UI plugin to the console created in my UI plugin.

I've read <a href="https://stackoverflow.com/questions/2127718/eclipse-rcp-how-to-redirect-the-output-to-console-view">this post</a> and <a href="http://waynebeaton.wordpress.com/2006/10/19/displaying-the-console-in-your-rcp-application/" rel="nofollow noreferrer">this one</a>, but they do not specify how to "get ahold" of the output which is generated within the
Code:
launch()
method in the first place.

Any pointers would be really welcome, I am stuck!