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 9299037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:28:05+00:00 2026-06-18T22:28:05+00:00

I’m currently writing a program and I was wondering if it’s possible for eclipse

  • 0

I’m currently writing a program and I was wondering if it’s possible for eclipse to open up separate consoles automatically for each main when I run the following main method:

public static void main(String[] args) {
    object1.main(args);
    object2.main(args);
    object3.main(args);
    object4.main(args);
}

My current solution is to run each main method and select the appropriate one to view within the “Display Selected Consoles” option although it’s a very tedious process everytime I want to test my program out. I’d be very grateful for any suggestions you have.

Thanks

  • 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-06-18T22:28:06+00:00Added an answer on June 18, 2026 at 10:28 pm

    If you do multiple calls to your main method from within another main method, this will not be different from calling any other static method multiple times. Particularly, all those instances of your program will be executed in the same JVM.

    Instead, you could use a simple Ant script to start multiple instances of your program, for example:

    <?xml version="1.0"?>
    <project name="Test" default="run_external">
        <target name="compile">
            <delete dir="bin" />
            <mkdir dir="bin" />
            <javac srcdir="src" destdir="bin" />
        </target>
        <target name="run_many" depends="compile">
            <parallel>
                <java classname="test.Main" classpath="bin" />
                <!-- copy-paste 'java' block for more instances -->
            </parallel>
        </target>
        <target name="run_external" depends="compile">
            <parallel>
                <exec executable="xterm" dir="bin">
                    <arg value="-e" />
                    <arg value="java test.Main" />
                </exec>
                <!-- copy-paste 'exec' block for more instances -->
            </parallel>
        </target>
    </project>
    

    This script defines three targets — which of them is executed is determined in the default parameter.

    • The first target, compile, just invokes javac to build all the sources in the src directory. This is automatically executed before any of the other targets are run.
    • The second target, run_many, simply starts your Main class several times in parallel. Each instance will run in a separate JVM, but the output of all those instances will be mixed up in Eclipse’s console window.
    • The third target, run_external, starts an xterm terminal emulator running the respective Java processes, i.e. for each instance of your program a new terminal should pop up. (When doing this on Windows you may have to use cmd.exe or similar.)

    Not sure whether this is what you were looking for. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an app for my school newspaper, which is run completely online
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am writing an app with both english and french support. The app requests
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.