moaxcp / x11

An x11 protocol implementation and client for the jvm
MIT License
20 stars 3 forks source link

java.net.SocketException: Cannot find method "setCreated" or field "created" in java.net.Socket. Unsupported JVM? #20

Closed freedom1b2830 closed 8 months ago

freedom1b2830 commented 1 year ago

code:

import java.io.IOException;

import com.github.moaxcp.x11client.X11Client;
import com.github.moaxcp.x11client.protocol.DisplayName;
import com.github.moaxcp.x11client.protocol.xproto.CreateWindow;
import com.github.moaxcp.x11client.protocol.xproto.EventMask;

public class WMTest {
    public static void main(final String[] args) throws InterruptedException, IOException {
        try (var x11Client = X11Client.connect(DisplayName.displayName(":1"))) {
            final var EXPOSURE = EventMask.EXPOSURE;
            final var KEY_PRESS = EventMask.KEY_PRESS;

            final var window = CreateWindow.builder().depth(x11Client.getDepth(0)).wid(x11Client.nextResourceId())
                    .parent(x11Client.getRoot(0)).x((short) 10).y((short) 10).width((short) 600).height((short) 480)
                    .borderWidth((short) 5)
                    // .clazz(COPY_FROM_PARENT)

                    .visual(x11Client.getVisualId(0)).backgroundPixel(x11Client.getWhitePixel(0))
                    .borderPixel(x11Client.getBlackPixel(0)).eventMaskEnable(EXPOSURE, KEY_PRESS).build();
            Thread.sleep(100000);
        }
    }
}

exception:

Exception in thread "main" com.github.moaxcp.x11client.X11ClientException: Could not connect with :1.0
    at com.github.moaxcp.x11client.X11Client.connect(X11Client.java:80)
    at WMTest.main(WMTest.java:12)
Caused by: java.net.SocketException: Cannot find method "setCreated" or field "created" in java.net.Socket. Unsupported JVM?
    at org.newsclub.net.unix.NativeUnixSocket.setCreated(Native Method)
    at org.newsclub.net.unix.AFUNIXSocket.setIsCreated(AFUNIXSocket.java:56)
    at org.newsclub.net.unix.AFUNIXSocket.<init>(AFUNIXSocket.java:50)
    at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:79)
    at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:74)
    at org.newsclub.net.unix.AFUNIXSocket.connectTo(AFUNIXSocket.java:108)
    at com.github.moaxcp.x11client.X11Connection.connect(X11Connection.java:116)
    at com.github.moaxcp.x11client.X11Connection.connect(X11Connection.java:141)
    at com.github.moaxcp.x11client.X11Client.connect(X11Client.java:78)
    ... 1 more

versions:

java:

/usr/lib/jvm/java-21-openjdk/bin/java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

maven deps:

[INFO]    com.kohlschutter.junixsocket:junixsocket-core:jar:2.3.2:runtime
[INFO]    com.kohlschutter.junixsocket:junixsocket-common:jar:2.3.2:runtime
[INFO]    com.kohlschutter.junixsocket:junixsocket-native-common:jar:2.3.2:runtime
[INFO]    net.java.dev.jna:jna:jar:5.13.0:compile
[INFO]    org.projectlombok:lombok:jar:1.18.30:provided
[INFO]    com.github.moaxcp.x11:x11-client:jar:0.11.0:compile
kohlschuetter commented 1 year ago

Please update the junixsocket dependency in build.gradle to

implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.8.3'
moaxcp commented 1 year ago

Yes. It looks like gradle needs upgraded as well.

freedom1b2830 commented 1 year ago

Please publish the updated version in maven central

moaxcp commented 1 year ago

Still working on it

moaxcp commented 12 months ago

It is published in version 0.12.0.