Note that there are some explanatory texts on larger screens.

plurals
  1. POLockDisplay: Unable to load X11 when using JNA to lock display
    primarykey
    data
    text
    <p>I am trying to lock the display (disallowing the user to use the keyboard and mouse) in Java, using X11 through JNA.</p> <p>However, when I try running the application on Windows, I get this error:</p> <pre><code>java.lang.UnsatisfiedLinkError: Unable to load library 'X11': com.sun.jna.Native.open(Ljava/lang/String;)J at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239) at com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:140) at com.sun.jna.Native.loadLibrary(Native.java:393) at com.sun.jna.Native.loadLibrary(Native.java:378) at com.sun.jna.platform.unix.X11.&lt;clinit&gt;(X11.java:347) at octostar.LinuxHelper.blockInput(LinuxHelper.java:77) at .... .... </code></pre> <p>My code is this (the input parameter is a boolean 'block'):</p> <pre><code> boolean returnVal = true; X11.Display dpy = null; final X11 x11 = X11.INSTANCE; final Xss xss = Xss.INSTANCE; try { dpy = x11.XOpenDisplay(null); if (block) xss.XLockDisplay(dpy); else xss.XUnlockDisplay(dpy); } catch (Exception ex){ returnVal = false; } finally { if (dpy != null) x11.XCloseDisplay(dpy); dpy = null; } return returnVal; </code></pre> <p>The error occurs at X11.INSTANCE (which is the line octostar.LinuxHelper.blockInput(LinuxHelper.java:77) as in the error message above)</p> <p>In another part of my code, I get this error:</p> <pre><code>java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.platform.unix.X11 at octostar.LinuxHelper.getIdleTimeMillis(LinuxHelper.java:50) </code></pre> <p>I tried typing X11 in terminal, and they told me to do an installation, which I did after that, but every subsequent time I type X11 it says it's not installed. When I type the installation command though, I am told that I have the latest version already.</p> <p>This is all very confusing to me. If anyone could help shed some light on this I would greatly appreciate it!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload