Omar Kooheji
Omar Kooheji

Reputation: 55780

Eclipse open console apps in separate window

Is there a way to configure eclipse to open console apps in a new window rather than it's own console when you run/debug them?

I'm debugging a client/server application and I'd like to see the output of both apps at once and not have to switch between the tabs...

Upvotes: 21

Views: 39163

Answers (4)

rich p
rich p

Reputation: 975

This is an old question, but I ran across this - and in my case, I have a Python program that I want to run in a separate DOS window.

My solution was to create a run configuration for CMD.exe under "External Tools".

  • I opened Run > External Tools > External Tools Configurations...
  • I right-clicked on Program (on the left) and picked New Configuration and named it "RunFooUnderCMD" (Foo being my project)
  • Under "Location" I put C:\Windows\System32\cmd.exe
  • Under "Working Directory" I put ${workspace_loc:Foo/}
  • Under "Arguments" I put the following all on one line:
/c start cmd /c python -u ${workspace_loc:Foo/path/to/startup.py}

(note that I used forward-slashes even though it is Windows)

and clicked "Apply" and "Close".

Voila! I can navigate to "Run > External Tools > 1 RunFooUnderCMD" and run my program.

Eclipse also automagically provides further menu shortcuts; exploring those are left as an exercise to the reader. :-)

Upvotes: 0

kirenpillay
kirenpillay

Reputation: 349

When you create the second console, click on "Pin Console" and this will keep the console attached to the last application it was used for.

Upvotes: 2

Fortega
Fortega

Reputation: 19702

In eclipse, you can have two console views... On the console view, you have a button called 'open console' (the most right button in the console view). If you click this and select option 3 (new console view), you will see two consoles.

If you right click on the console tab and click on 'detached' the console will be detached from the eclipse frame. (for Eclipse Juno, see the HRJ's comment below)

You can select which output you want to see on each console by clicking the 'display selected console' button (second button from the right on the console view)

Upvotes: 40

Ross Judson
Ross Judson

Reputation: 1142

I have a different solution to this that works for my situation, and can probably be adapted by others.

I actually want a real second console window -- gnome-terminal in my case. I want this because I want ANSI color support and I want JLine to operate correctly. I can separately start my program and connect remotely for debugging, but that's annoying.

Locate where Java runs from, for the JRE eclipse will run as part of your debug config. Create a script there named gjava, give it the following content, and set it executable:

#!/bin/sh
gnome-terminal -x java $*

Then, in your launch configuration, on the common page, uncheck "Allocate console". On the JRE page, under Java executable, choose "Alternate" and enter gjava.

When Eclipse launches in debug mode, it will launch a gnome terminal and pass the remaining args to the Java processor, which will be running inside its window.

At that point you have a real console that supports JLine, ANSI colors, and full debug support.

Upvotes: 5

Related Questions