WebSockets in Tomcat and eclipse

Hi Experts,

I'm trying to add the following sample to my project:

Although my build path points to:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\websocket-api.jar,

Eclipse still has red lines under all my imports at the top of the class (and ServerEndpoint)
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;


Not sure why eclipse is not recognizing these, my colleague did the same thing and doesn't have this issue.

Any idea why?

Many thanks,
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Check whether the build path entry has taken effect. In the "Project Explorer", under your project it should list (in addition to source folders, etc) all the libraries that are part of it, including the "JRE System Library". Does websocket-api.jar show up here?

If it does show up there, maybe try doing a "Project" -> "Clean" or restarting Eclipse to get it to properly recognise the imports in your source file.

If it does NOT show up, double check your build path settings. Maybe post a screenshot of the build path page for us to look over. Also, check out the ".classpath" file that should be in the root of your project directories, and the websocket-api.jar should be listed in there. Maybe post the contents of that file here too for us to look at.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
threadyAuthor Commented:
thank you
mccarlIT Business Systems Analyst / Software DeveloperCommented:
You're welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.