Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse console output

 
Tim Williams
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dave Steinberg
Author
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Dave Steinberg
Author
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic