-4

i try to create server-client with websockets in JDK. Unfortunately i cannot import javax.websocket.* (As it is only java EE).

Is there a way to implement Websockets with JDK? I cant find a working example. Or do i have to use generic sockets?

Hunselfunsel
  • 329
  • 1
  • 3
  • 15
  • 1
    If something is not in the JDK, you cannot use it when only having the JDK. What answer do you expect here? Simply add a dependency to JEE ... – Seelenvirtuose Aug 03 '18 at 08:18
  • This can help: https://stackoverflow.com/questions/33262947/what-are-the-available-java-ee-websockets-implementations – juzraai Aug 03 '18 at 08:19
  • @Seelenvirtuose could you explain me how to do that or now a tutorial for adding JEE dependency? – Hunselfunsel Aug 03 '18 at 08:28

1 Answers1

1

If the dependency is missing download it and add it to your JAR:

Right-click the project folder for the project on which you are working, and click Properties. Click Java Build Path in the left pane. Click the Libraries tab. Complete one of the following steps: To add an internal dependency, click Add JARs, select the JAR file that you want to add, then click OK.

or create a maven project and let it manage your dependencies.

Or just take a look in the tutorial how to create a maven project for websockets: tutorial

the hand of NOD
  • 1,639
  • 1
  • 18
  • 30
  • Thank you, it says i need to edit a pom.xml file. I dont have that in my project and cant find a tutorial on where/how to create it. I am using Eclipse Photon – Hunselfunsel Aug 03 '18 at 08:38
  • So why the downvote dude? It's a tutorial for maven projects. If you do not know what a maven project is, use google to find the tutorial. http://www.baeldung.com/maven for example. Or use the tutorial from oracle itself: http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/HomeWebsocket/WebsocketHome.html and please don't assume that someone just writes the code for you. – the hand of NOD Aug 03 '18 at 09:02
  • ok. thanks. I understand. But to write a complete tutorial just because someone doesn't use google seems a bit overloaded to me. Even if the link expires at some time. – the hand of NOD Aug 03 '18 at 09:06
  • If an answer needs to be a complete tutorial the question is too broad for Stack Overflow and you should vote to close. Note that the downvote is probably not from the OP but someone else who saw a link-only answer. – greg-449 Aug 03 '18 at 09:19
  • 1
    I didnt downvote but i upvoted now so that it is even again – Hunselfunsel Aug 03 '18 at 09:47