*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse console output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse console output" Watch "Eclipse console output" New topic
Author

Eclipse console output

Tim Williams
Greenhorn

Joined: Feb 12, 2001
Posts: 27
I'm writing my own plugin in Eclipse and I want to write output to the console - just a simple equivalent of 'System.out'.
How do I do this?
I can write to standard out, and it works fine in the test environmnet, except that it appears in the console of the parent workbench. When I deploy my plugin the output just vanishes (it doesn't appear anywhere that I can find at least).
Will the solution be the same for Eclipse 2.0 and 2.1?
Any thoughts, hints or code samples greatly appreciated.
Tim.
Dave Steinberg
Author
Greenhorn

Joined: Aug 18, 2003
Posts: 20
Tim, I've found that some platforms (i.e. Windows) block the standard out and error streams when the Eclipse executable is run. If, instead, you directly invoke Eclipse under the JVM, you should be able to see what is being written to the console.
Assuming your JVM executable is called java.exe and is in your path, the following command should do the trick:
java -cp <path-to-eclipse>\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ui.workbench
Hope that helps.
Cheers,
Dave


Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0131425420/ref=jranch-20" target="_blank" rel="nofollow">Eclipse Modeling Framework</a>
Dave Steinberg
Author
Greenhorn

Joined: Aug 18, 2003
Posts: 20
Whoops, sorry, that got munged. That should have been:
java -cp <path to eclipse>\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ui.workbench
Tim Williams
Greenhorn

Joined: Feb 12, 2001
Posts: 27
Thanks Dave.
Hmmm... I wonder where does the output appear though?
Maybe I should have made it clear I want the output to appear in the Eclipse console.
I can't ask people using my plugin to use a special startup command to see the console output
I also didn't want to confuse the issue but it's really WSAD 5.01 or 5.1 that I will be deploying to and again I don't want to have to force output by modifying the shortcut.
How does Ant make it's output appear inside Eclipse?
Tim.
ps. You wouldn't happen to work in the UK for ABN Amro would you Dave?
[ September 24, 2003: Message edited by: Tim Williams ]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Tim Williams:
How does Ant make ist's output appear inside Eclipse?

Why don't you just take a look at the source code?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Dave Steinberg
Author
Greenhorn

Joined: Aug 18, 2003
Posts: 20
Hi Tim,
Whoops, my bad. I didn't realize you wanted the output to go to the Eclipse console. I figured you just meant the system console that you're launching Eclipse from.
The console view seems to be closely assoicated with debugging: it looks like you can launch another process, directing its output to the console, and even monitor and annotate that output. That's what Ant seems to do. But, I don't think you can just redirect text to the console. That doesn't seem to be what it's designed for.
Do you have a newsgroup/mailing list account at Eclipse? If so, here's an old proposal for the shared console design.
I'm not sure exactly what you're trying to output, but if it's something that a user shouldn't ignore, a dialog box would probably be appropriate. Otherwise, you should probably just log it. Note that the log can be redirected to the console view, by running with the "-consolelog" switch.
Cheers,
Dave
PS Nope, I work in Canada, for IBM.
Tim Williams
Greenhorn

Joined: Feb 12, 2001
Posts: 27
Dave,
Thanks once more. I had thought a dialog (or my own output area) would be more trouble than it was worth and I wanted to achieve a similar effect to Ant, but I'm not launching a process in the same way. Maybe I was wrong, and my own dialog would be easier. Another though I had was that using the Console would be reusing the facilities of Eclipse more efficiently.
Now I know the principle behind what Ant is doing I may take another look at the source. I got somewhat lost in my last attempt. It would be so nice if there were technical design documents for some of these components!
Thanks for your input,
Tim.
[ September 24, 2003: Message edited by: Tim Williams ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse console output