title: Is it possible to use Java WebSockets in Eclipse without Jetty?
body: <p>I am trying to develop a web server using Java's WebSockets. I am using Eclipse with Tomcat 7, so the javax.websocket-jar file is already included.</p>
  
  <p>I created a simple ServerEndpoint</p>
  
  <pre><code>import javax.websocket.OnMessage;
  import javax.websocket.server.ServerEndpoint;
  
  @ServerEndpoint("/login")
  public class LoginServer {
      @OnMessage
      public String onMessage(String message) {
          User foobar = new User("Foo", "Bar", "Baz");
          return foobar.toString();
      }
  }
  </code></pre>
  
  <p>Then I opened the console in Firefox and tried to connect:</p>
  
  <pre><code>var ws = new WebSocket('ws://localhost:8080/MyServer/login');
  </code></pre>
  
  <p>This ends in an error message which says it can't connect (404).</p>
  
  <p>So I searched the web and found this Jetty thing. I don't really want to add an unnecessary layer on top of my software, but I couldn't find a way to connect to my server.</p>
  
  <p>Do I need to use Jetty when programming WebSockets in Eclipse? If so, why?</p>