Can't find Jetty WebSocket classes after adding the libraries in classpath
eclipse, java, jetty, websocket
Solution
Remove the `start.jar` from your project, that's just a bootstrap jar for starting the standalone Jetty distribution.
The JARs you need are in the `${jetty.dist}/lib/websockets/` directory.
[joakim@lapetus jetty-distribution-9.0.4.v20130625]$ ls -1 lib/websocket/
websocket-api-9.0.4.v20130625.jar
websocket-client-9.0.4.v20130625.jar
websocket-common-9.0.4.v20130625.jar
websocket-server-9.0.4.v20130625.jar
websocket-servlet-9.0.4.v20130625.jar
All WebSocket Apps
Always include in your project:
- `lib/websocket/websocket-api-9.0.4.v20130625.jar`
WebSocket Client Requirements
Add the following to your project:
- `lib/websocket/websocket-client-9.0.4.v20130625.jar`
- `lib/websocket/websocket-common-9.0.4.v20130625.jar`
- `lib/jetty-io-9.0.4.v20130625.jar`
- `lib/jetty-util-9.0.4.v20130625.jar`
WebSocket Servlet Requirements
If you are writing a WebSocket server that will hook into your WAR/WebApp, then you'll need:
- `websocket-servlet-9.0.4.v20130625.jar`
You will never need `websocket-server-9.0.4.v20130625.jar` as that is an internal / implementation specific JAR that the Jetty Server uses to provide its support for WebSockets.
Problem
I'm trying to use Jetty to communicate with a remote Server, using websockets. I'm developing it in Eclipse, but i can't compile any sample code. That's what i've done I downloaded the latest version of Jetty, and i've added start.jar in the classpath. That's what i've included in the sample class ``` import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; ``` and some more. The problem is that Eclipse can't resolve those imports. What should i do?