title: How to start/stop and monitor a java thread?
body: <p>I am trying to figure out how to start and stop a serial interface. </p>
  
  <pre><code>class SerialInterface implements Runnable{
  
  
  
  
   // Stream from file
  @Override
  public void run(){
      try {
              startInterface();
          } catch (IOException ex) {
              Logger.getLogger(SerialInterface.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  
      public static void main( String StartStop ){
          SerialInterface SerialThread = null;
  
          if ( StartStop.equals("start")){
          SerialThread = new SerialInterface();
          Thread thread1 = new Thread (SerialThread);
          thread1.start();
          } else {
              SerialThread = null;
          }
      }
  
   private void startInterface() throws IOException {  //START DOING STUFF TO SERIAL PORT }
  </code></pre>
  
  <p>This does not work.  How do I stop a thread which was started?</p>