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

  • Home
  • SEARCH
  • 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 8769261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:17:42+00:00 2026-06-13T17:17:42+00:00

I did a little client server application in Java on LinuxOS, where the server

  • 0

I did a little client server application in Java on LinuxOS, where the server receives different commands from the client and processes them by starting different threads. There is one specific thread for each command.

My main-program starts a thread, that responds to different commands and consists simplified of one infinite loop. There is no exit out of the loop yet. This Thread prints to the Terminal, where the main-program was started, but the commands after “.start()” aren’t executed.

ServerSend servSend = new ServerSend(arg);
System.out.println("1"); 
servSend.start();
System.out.println("2");`

So “2” is never printed, whereas some “System.out.println()” inside the thread work. Does anybody have an idea why?

  • 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-13T17:17:44+00:00Added an answer on June 13, 2026 at 5:17 pm

    If you are trying to spawn a new thread, I assume ServerSend implements java.lang.Runnable or extends java.lang.Thread in which case you should be overwriting the public void run() method, not the start() method.

    ie:

    public class ServerSend implements java.lang.Runnable {
        public Thread thread;
        public ServerSend(arg) {
            //constructor
            thread = new Thread(this);
        }
        public void run() {
            //the contents of this method are executed in their own thread
        }
    }
    

    And then use it with;

    ServerSend s = new ServerSend(arg);
    s.thread.start();
    

    Public access to thread allows you to do things like;

    s.thread.interrupt();
    

    This is my preferred method (using Runnable) others prefer to extend Thread. This answer pretty much sums up my thinking: https://stackoverflow.com/a/541506/980520

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

Sidebar

Related Questions

I am veteran server side java developer. I have little experience in client web
I want to check for user inactivity in my application. I did a little
I did a script, which has to load a file from a ftp-server then
I have my little client application which - when started - creates some user
I did a little bit of Web Programming here and there but I never
I did a little research and I didn't find a way, anyone know? c#
I did a little research with the String's contains and replaceAll methods. char c
I've been thinking about creating a forum in PHP so I did a little
Why did some processor manifacturers decide to use Little endian Big endian Middle endian
I have a little problem. i searched but did not get help to solve

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.