TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.47k stars 2.57k forks source link

Error when build and run JDK >8 #1303

Closed gamethapcam closed 1 year ago

gamethapcam commented 1 year ago

I have some errors when build IOS + using your lib for connect websocket . I used JDK 11 java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer; java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip(I)Ljava/nio/ByteBuffer; java.lang.NoSuchMethodError: java.nio.ByteBuffer.mark(I)Ljava/nio/ByteBuffer;

PhilipRoman commented 1 year ago

Not enough information - please include what OS and java version you are using. I am using this library with Java 19 and it works fine

gamethapcam commented 1 year ago

I use jdk 11 for build ios. i use "libgdx platform"

PhilipRoman commented 1 year ago

This issue happens when you compile with JDK 9+ and run with Java 8. Here is an article that explains it in details: https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/

If you download the jar automatically using something like Maven or Gradle, this error shouldn't happen because the jar will be built correctly. If you compile it yourself, use the --release=8 option

If you need more help with this, post a link to your code.

PhilipRoman commented 1 year ago

Closing as solution is provided and no activity