Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6651343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:59:59+00:00 2026-05-26T00:59:59+00:00

I want to make a plugin for Eclipse. The thing is that I looked

  • 0

I want to make a plugin for Eclipse. The thing is that I looked into the API, and examples, and I managed to make a button on main bar, with a specific icon, and when I click it, open up an InputDialog.

The hard part, is that I want to start an aplication from this button, but not with Runtime as it was a new process. I simply want to start a class inside plugin, which will log in to a server and get some output from it. I want it to be opened in a console, like launching a normal application, or a separate console.

The best example of this kind is a Tomcat plugin which starts Tomcat, and then outputs the console to the Eclipse console. I want to do that too. I’ve looked at the Tomcat source plugin, but I got stuck there too. They use their own launcher.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:59:59+00:00Added an answer on May 26, 2026 at 12:59 am

    I am not sure what you mean by “I want to simply start a class”. I assume there is a command line tool that you want to execute and redirect its output to the console window.

    To be able to do that without spawning a new process, you have to be able to control the output stream of the tool. If it cannot be controlled, then you have no choice but to start a new process to properly capture the tool’s output.

    It is technically possible to call System.setOut instead, but it will redirect output from all threads to your console which is not what you want.

    Nevertheless you start by creating a console:

    // function findConsole copied from:
    // http://wiki.eclipse.org/FAQ_How_do_I_write_to_the_console_from_a_plug-in%3F
    private MessageConsole findConsole(String name) {
        ConsolePlugin plugin = ConsolePlugin.getDefault();
        IConsoleManager conMan = plugin.getConsoleManager();
        IConsole[] existing = conMan.getConsoles();
        for (int i = 0; i < existing.length; i++)
           if (name.equals(existing[i].getName()))
              return (MessageConsole) existing[i];
        //No console found, so create a new one.
        MessageConsole myConsole = new MessageConsole(name, null);
        conMan.addConsoles(new IConsole[]{myConsole});
        return myConsole;
    }
    
    // Find my console
    MessageConsole cons = findConsole("MyTool Console");
    MessageConsoleStream out = cons.newMessageStream();
    
    // Optionally get it's input stream so user can interact with my tool
    IOConsoleInputStream in = cons.getInputStream();
    
    // Optionally make a differently coloured error stream
    MessageConsoleStream err = cons.newMessageStream();
    err.setColor(display.getSystemColor(SWT.COLOR_RED));
    
    // Display the console.
    // Obtain the active page. See: http://wiki.eclipse.org/FAQ_How_do_I_find_the_active_workbench_page%3F
    IWorkbenchPage page = ...;
    String id = IConsoleConstants.ID_CONSOLE_VIEW;
    IConsoleView view = (IConsoleView) page.showView(id);
    view.display(cons);
    

    Then set the input and output streams of my tool and start processing in a different thread so the UI will not block.

    // Create my tool and redirect its output
    final MyTool myTool = new MyTool();
    myTool.setOutputStream(out);
    myTool.setErrorStream(err);
    myTool.setInputStream(in);
    
    // Start it in another thread
    Thread t = new Thread(new Runnable() {
        public void run() {
            myTool.startExecuting();
        }
    });
    t.start();
    

    If your tool does not support I/O redirection, you have no choice but to start it in another process with the ProcessBuilder and use a number of threads to move data between console and process streams See: Process.getInputStream(), Process.getOutputStream() and Process.getErrorStream().

    The following links have additional useful details:

    • Executing a Java application in a separate process
    • FAQ How do I write to the console from a plug-in?
    • FAQ How do I find the active workbench page?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make the build process for my Eclipse RCP plugin fully automatic.
I have Eclipse with m2 plugin and want to make new project with Spring.
This is plugin that I want, Eclipse Color Theme 0.9.1 http://marketplace.eclipse.org/content/eclipse-color-theme https://github.com/eclipse-color-theme/eclipse-color-theme I only
In the eclipse plugin I am working on, I want to make editable the
i make a test application in eclipse with adt plugin. I want when a
I want to make an etag that matches what Apache produces. How does apache
I want to make a table in SqlServer that will add, on insert, a
I want to make an entity that has an autogenerated primary key, but also
I have an existing Eclipse plugin that provides an extension point. The plugin uses
I have made a simple experimental language of my own. I want make Eclipse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.