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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:46:35+00:00 2026-05-28T16:46:35+00:00

How to suspend and resume a thread user input through the command prompt? I

  • 0

How to suspend and resume a thread user input through the command prompt?

I want a program where user can get the thread running from the stage where he stooped the thread by suspending.

package foo;

import java.util.Vector;

public class ThreadTest {

private Vector<String> threadNames = new Vector<String>();

public static void main(String[] args) {

    ThreadTest test = new ThreadTest();

    test.threadTest(Integer.parseInt(args[0]));

    System.out.println(test.threadNames);

}

private void threadTest(int numOfThreads) {

    Thread[] threads = new Thread[numOfThreads];

    for (int i = 0; i < threads.length; i++) {

        threads[i] = new foo.ThreadTest.MyThread();

        threads[i].start();

    }

    for (int i = 0; i < threads.length; i++) {

        try {

            threads[i].join();

        } catch (InterruptedException ignore) {}

    }

}

class MyThread extends Thread {

    public void run() {

        for (int i = 0; i < 1000000; i++) {

            i = i + 0;

        }

        threadNames.add(getName());

    }

}

}

  • 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-28T16:46:36+00:00Added an answer on May 28, 2026 at 4:46 pm

    You have a number of options. All will require some sort of RPC. The best approach will likely be based on JMX.

    In particular, take a look at everything that is available on the ThreadMXBean (JMX). Now, this doesn’t provide you the exact functions it sounds like you’re looking for, but you could write your own that provides the extended functions you need.

    Also, JMX is typically accessed through something like jconsole – which is GUI based. However, JMX is just an API, and you could write your own console-based client that exposes the functionality you require through CLI.

    See also: calling java methods from a terminal

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

Sidebar

Related Questions

I can suspend the thread with user input in console,but can't resume it again
Can I get a threads suspend count under Windows CE, using C or Visual
I need to be able to suspend and resume the main thread in a
I can suspend a thread of another process by using SuspendThread(). Is there any
I want to suspend (pause) a forked process at startup and resume it later
In Win32 I want to suspend a thread using Suspend(GetCurrentThread()); but I find I
I have a thread that running into an activity. I don't want that the
hi all i doing a stop watch. for pause i use Thread.suspend() and resume
I have a thread doing things in background and I want to suspend it
Many methods like stop() , resume() , suspend() etc are deprecated. So is it

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.