title: No enclosing instance of type ... is accessible
body: <p>For educational purposes I tried to make a server and client where the server receives data from multiple clients and echoes each message. The problem is when I try to make the server send the echo to all of the clients at once.  </p>
  
  <pre><code>public class SocketServer {
    ArrayList&lt;MyRunnable&gt; ts = new ArrayList&lt;MyRunnable&gt;();
    ServerSocket serv;
    static MainServerThread mst = new MainServerThread();
  //                                  ^ IDE(eclipse) underlines this as the problem
    SocketServer() {
      EventQueue.invokeLater(mst);
    }
  
    public static void main(String[] args) { 
      Thread tr = new Thread(mst);
      tr.start();
    }
  
    void send(String s) {
      for (int i = 0; i &lt; ts.size(); i++) {
        MyRunnable tmp = ts.get(i);
        tmp.sendToClient(s);
      }
    }
  
    class MainServerThread implements Runnable {
      public void run() {
        try {
          serv = new ServerSocket(13131);
          boolean done = false;
          while (!done) {
            Socket s = serv.accept();
            MyRunnable r = new MyRunnable(s);
            Thread t = new Thread(r);
            ts.add(r);
            t.start();
          }
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  
    class MyRunnable implements Runnable {
      Socket sock;
      PrintWriter out;
      Scanner in;
      MyRunnable(Socket soc) {
        sock = soc;
      }
  
      public void run() {
        try {
          try {
            out = new PrintWriter(sock.getOutputStream(), true);
            in = new Scanner(sock.getInputStream());
            boolean done = false;
            while (!done) {
              String line = in.nextLine();
              send("Echo: " + line);
              System.out.println("Echo: " + line);
              if (line.trim().equals("BYE")) done = true;
            }
          } finally {
            sock.close();
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
  
      public void sendToClient(String s) {
        out.println(s);
      }
    }
  }    
  </code></pre>
  
  <p>I have searched for and answer and saw many similar questions, but none of them helped me.
  Hope you can point out my mistake.  Thanks in advance.</p>